A fractional‐order PID controller is a generalization of a standard PID controller using fractional calculus. Compared with the standard PID controller, two adjustable variables, “differential order” and “integral order”, are added to the PID controller. Fractional‐order PID is more flexible, has better responses, and the precise adjustment closed‐loop system stability region is larger than that of a classic PID controller. But the design and stability analysis is more complicated than for the PID controller. Therefore, the optimal setting of parameters is very important. A firefly algorithm in standard mode has only local optimization and accuracy is low. In order to fix this flaw an improved chaotic algorithm firefly is proposed for a design controller FOPID. To evaluate the performance of the proposed controller, it has been used in the control of a CSTR system with a variety of fitness functions. Simulations confirm the optimal performance of the proposed controller.