In situ growth of nano-sized layered double hydroxides (LDH) conversion film on AZ31 alloy was synthesized by a urea hydrolysis method. The formation mechanism of the film was proposed. Firstly, the dissolved Mg2+ ions deposited into a precursor film consisted of MgCO3 and Mgs(CO3)4(OH)2·4H2O; secondly, the precursor translated into the crystalline Mg(OH)2 in alkaline conditions; finally, the Mg2+ ions in Mg(OH)z were replaced by A13+ ions, Mg(OH)2 translated into the more stable LDH structure, simultaneously, the OH- ions in the interlayer were exchanged by CO32-, thus led to the formation of the LDH (Mg6Alz(OHh6CO3·4H2O) film. The results indicated that the LDH film characterized by interlocking plate-like nanostructures and ion-exchange ability significantly improved the corrosion resistance of the AZ31 Mg alloy.