In this paper, a real-time algorithm is proposed for nonlinear infinite horizon optimal control. The time axis transformation of the horizon is combined with receding horizon control to realize state feedback by numerical optimization over an infinite horizon. Moreover, a descriptor equation is utilized in place of a state equation to avoid the numerical difficulty due to the infinite horizon. Then a nonlinear equation is obtained to determine the trajectories of the state, costate, and control input over the transformed horizon. The nonlinear equation is solved at each sampling time by a continuation method to trace a time-varying solution. The proposed algorithm is applied to nonlinear systems to evaluate its accuracy and effectiveness. Copyright © 2012 John Wiley & Sons, Ltd.