Anodized films on AZ91D magnesium alloy were prepared in sodium hydroxide based solution. Structure and properties of the anodized films were investigated by X-ray diffraction (XRD), scanning electron microscope (SEM) and electrochemical potentiodynamic polarization analysis. The results of XRD showed that the films were mainly composed of Mg(OH)2 and Al(OH)3. As the solution temperature increasing, the anodized films became thicker and denser, which could cover up the substrate. The films also became thicker and denser with the increase of anodizing time. The grain in the films grew fast when anodic current density increasing and a larger grain size would be found at a higher anodic current density. The results of microscopic analysis exhibited the porous-type anodic oxide, which was similar to the films on aluminum alloy. The results of electrochemical potentiodynamic polarization analysis showed that thermodynamic stability of the alloy had a certain improvement after anodization. The anodized films also exhibited an obvious increase of polarization resistance RP and an obvious decrease of corrosion current density ic. Discoloration time of drop test on the films lasted for 30 min, which indicated that corrosion resistance of the magnesium alloy was greatly improved by anodization.