In this paper, the dual-component silane films composed of trimethoxysilane and bis [3-(triethoxysilyl)propyl]tetrasulfide (BTESPT) were prepared on the surface of AZ31B Mg alloys. The selected trimethoxysilanes had different chain length. The results showed that the dual-component silane films could effectively enhance the corrosion resistance of Mg alloys. Moreover, with the enlarging of the chain length of trimethoxysilane, the hydrophobic property and the corrosion resistance of the dual-component silane films were enhanced. And the dual-component silane film composed of BTESPT and octadecyltrimethoxysilane (OTMS) showed the highest contact angle and the best corrosion resistance. It could be ascribed to the high density of CH 2 groups and -S-S-S-Sin the dual-component silane film, greatly improving the hydrophobicity and the anticorrosion property. Simultaneously, the substantial Si-O-Si network in the dual-component silane film also enlarged the length of the penetration paths for corrosive media, delaying the corrosion of the Mg alloy.