Purpose The coal-fired power plants have been confronted with new operation challenge since the unified carbon trading market was launched in China. To make the optimal decision for the carbon emissions and power production has already been an important subject for the plants. Most of the previous studies only considered the market prices of electricity and coal to optimize the generation plan. However, with the opening of the carbon trading market, carbon emission has become a restrictive factor for power generation. By introducing the carbon-reduction target in the production decision, this study aims to achieve both the environmental and economic benefits for the coal-fired power plants to positively deal with the operational pressure. Design/methodology/approach A dynamic optimization approach with both long- and short-term decisions was proposed in this study to control the carbon emissions and power production. First, the operation rules of carbon, electricity and coal markets are analyzed, and a two-step decision-making algorithm for annual and weekly production is presented. Second, a production profit model based on engineering constraints is established, and a greedy heuristics algorithm is applied in the Gurobi solver to obtain the amounts of weekly carbon emission, power generation and coal purchasing. Finally, an example analysis is carried out with five generators of a coal-fired power plant for illustration. Findings The results show that the joint information of the multiple markets of carbon, electricity and coal determines the real profitability of power production, which can assist the plants to optimize their production and increase the profits. The case analyses demonstrate that the carbon emission is reduced by 2.89% according to the authors’ method, while the annual profit is improved by 1.55%. Practical implications As an important power producer and high carbon emitter, coal-fired power plants should actively participate in the carbon market. Rather than trade blindly at the end of the agreement period, they should deeply associate the prices of carbon, electricity and coal together and realize optimal management of carbon emission and production decision efficiently. Originality/value This paper offers an effective method for the coal-fired power plant, which is struggling to survive, to manage its carbon emission and power production optimally.