A general formulation of the moving horizon estimator is presented. An algorithm with a fixed-size estimation window and constraints on states, disturbances, and measurement noise is developed, and a probabilistic interpretation is given. The moving horizon formulation requires only one more tuning parameter (horizon size) than many well-known approximate nonlinear filters such as extended Kalman filter (EFK), iterated EKF, Gaussian second-order filter, and statistically linearized filter. The choice of horizon size allows the user to achieve a compromise between the better performance of the batch least-squares solution and the reduced computational requirements of the approximate nonlinear filters. Specific issues relevant to linear and nonlinear systems are discussed with comparisons made to the Kalman filter, EKF, and other recursive and optimization-based estimation schemes.