Quadrotor unmanned aerial vehicle (UAV) has superior characteristics such as ability to take off and land vertically, to hover in a stable air condition and to perform fast maneuvers. However, developing a high-performance quadrotor UAV controller is a difficult problem as quadrotor is an unstable and underactuated nonlinear system. The effort in this article focuses on designing and optimizing an autonomous quadrotor UAV controller. First, the aerial vehicle's dynamic model is presented. Then it is suggested an optimal backstepping controller (OBC). Traditionally, backstepping controller (BC) parameters are often selected arbitrarily. The gravitational search algorithm (GSA) is used here to determine the BC parameter optimum values. In the algorithm, the control parameters are calculated using an integral absolute error to minimize the fitness function. As the control law is based on the theorem of Lyapunov, the asymptotic stability of the scheme can be ensured. Finally, several simulation studies are conducted to show the efficacy of the suggested OBC.