Cerium conversion coating is successfully deposited on magnesium alloy AZ31 for corrosion protection. Deposition time on the influence of cerium conversion coating morphology, composition, and electrochemical properties has been investigated in detail. Morphological observation reveals that the cerium conversion coating is a porous agglomerate nanostructure. XPS indicates that the coating exhibits a time-dependent ingredient. Moreover, the coating is considered as a combination of magnesium oxide/hydroxide and cerium (III) and (IV) oxides/hydroxides. The results of electrochemical impedance spectroscopy indicate that the anticorrosion coating exhibits the best properties during deposition of 5 min. In view of the analysis, the anticorrosion mechanism is pioneered proposed because of the formation of H-bonding layer, which forms a reasonable barrier to Cl− ions. Copyright © 2014 John Wiley & Sons, Ltd.