Polyelectrolyte-coated magnesium alloy was prepared by layer-by-layer assembly with poly (allylamine hydrochloride) (PAH) and sodium alginate (ALG). The potential influence of genipin as a crosslinking agent on the microscopic features and corrosion resistance of the coatings was examined using Fourier transform infrared spectroscopy (FT-IR), scanning electron microscopy (SEM), potentiodynamic polarization, and electrochemical impedance techniques. An improved anticorrosive property was observed for the crosslinked coating compared to the untreated one, which could be due to the formation of the network barrier against water and corrosion ions such as chloride and oxygen. Furthermore, the cytocompatibility evaluation of different samples by CCK-8 assay suggested that the treatment of genipin was beneficial to the MC3T3-E1 cell proliferation. The study may provide sufficient evidence to show that more efficient LbL assembled multilayer coatings for improving anticorrosion and cytocompatibility would be the ones with crosslinking treatment. • The polyelectrolyte multilayers on Mg alloys could be crosslinked by genipin. • The crosslinked network exhibits enhanced corrosion resistance. • The incorporated genipin also show biocompatibily. [ABSTRACT FROM AUTHOR]