This paper presents an optimal fuzzy PID (FPID) controller based on a particle swarm optimization (PSO) algorithm for automatic voltage regulation of excitation system in a single machine connected to infinite bus. The controller design depends on integral time square error (ITSE) in order to get the optimal objective function and to optimize the gains of the proposed controller. Simulation results of the proposed optimal FPID controller are compared with those resulting from PI and PID controllers based on PSO. Time responses of the system that the settling time and maximum overshoot with respect to FPID controller based on PSO are improved and showed a better performance than PI and PID controllers with selftuning capability and superior efficiency.