In this paper, the plasma electrolyte oxidation (PEO) technique was applied to modify the AZ31B Mg alloy surface. Effects of various concentrations of ZnO nanoparticles into an electrolyte with nanoparticles of hydroxyapatite (HAp) on the antibacterial and corrosion behavior of coatings were studied. Potentiodynamic polarization tests were done in Ringer's electrolyte to study the coatings corrosion behavior. Results of XRD indicated that the provided PEO films mostly have phases of HAp, MgO, and Mg 3 (PO 4 ) 2 and ZnO. The results indicated that increasing the concentration of ZnO nanoparticles raised the thickness, roughness, and wetting angle and also enhanced the coatings antibacterial activity. The inhibition percentage of bacterial growth for the specimen with the highest concentration of nanoparticles (4 g/L) after 6 h against E. coli and S. aureus was 23.5% and 45.5%, respectively. The concentration of nanoparticles had no major effect on the porosity size of the ceramic coating. Moreover, adding ZnO nanoparticles declined the corrosion current density and raised the corrosion potential with regard to the metal substrate. The formed coating in the solution containing 1 g/ L ZnO nanoparticles had the highest corrosion behavior among all of specimens that led to a 970 multiplication corrosion resistance of AZ31B Mg alloy.