The document proposes a chaotic firefly algorithm (CFA) to overcome the shortcomings of the original firefly algorithm getting stuck in local optima. CFA introduces chaos initialization, chaos population regeneration, and linear decreasing inertia weight to increase global search ability. CFA is tested on six benchmark functions and applied to optimize reactive power dispatch in an IEEE 30-bus system. Results show CFA performs better than the original firefly algorithm and particle swarm optimization in finding optimal solutions faster.