In this paper, spacecraft formation flying control under orbital perturbations by state-dependent Riccati equation method in the presence of on–off actuators is studied. Here, state-dependent Riccati equation is proposed as a more systematic and simple controller for solving the nonlinear problem of spacecraft formation flying in the leader–follower architecture. To create real conditions, the full nonlinear model of motion is considered while orbital perturbations are contained in the model. Also, to consider the operational conditions in controller design, on–off actuators are taken into account for the system. Due to the on–off nature of spacecraft thrusters, practical pulse-width pulse-frequency modulator is used for converting continuous signals to on–off pulses. Results are compared with other controllers to show the accuracy and performance of this method. In simulations, it is shown that the proposed controller as a new method has better performance confronting with the operational conditions including perturbations and on–off inputs. It is also shown that the energy consumption of the proposed controller is improved in comparison to other controllers.