This study presents a unified algebraic model based on the multi-layer mixing length to quantify the mean velocity of the transitional and fully turbulent boundary layer. Mean velocity profiles from direct numerical simulations of the zero-pressure-gradient boundary layer are being investigated. By using the gradient descent method, three parameters in the multi-layer mixing length are optimized and determined at each streamwise location. It turns out that the multi-layer mixing length model describes mean velocity profiles well, and the corresponding relative deviation is around 2%. This value is not less than, or even better than, the compared Nickels’ model [Nickels, J. Fluid Mech. 521, 217–239 (2004)]. Moreover, the variation of the three optimal parameters with Rex is similar to the streamwise development of the friction coefficient. This similarity offers a supplementary way to comprehend the transition process. The results confirm that the multi-layer length function is suitable for modeling transitional boundary layers.