© 2021, The Author(s), under exclusive licence to Springer-Verlag GmbH, DE part of Springer Nature.Magnesium zinc oxide (MgxZn1-xO) films (x < 0.4) have been grown by ultrasonic spray chemical vapor deposition on soda-lime glass substrates for different growth temperature and different Mg mole fractions (x). Effects of Mg content in the liquid solution and the effect of growth temperature on optical and structural properties of MgZnO films have been investigated with X-ray diffraction, atomic force microscope, and UV–visible spectrophotometry measurements. The growth temperature has a significant effect on determining the Mg mole fractions of MgZnO films. There is a linear correlation between the measured Mg mole fraction in the resulted grown structures and Mg content in the solution. The peak of (0002) diffraction for the grown samples has been shifted to the higher diffraction angles with increase in Mg content in the liquid solution and has also become stronger. The growth temperature and Mg content in a liquid solution are crucial parameters in the controlling Mg mole fraction of samples.