A multifractal analysis has been performed on the 3D (three-dimensional) surface microtexture of magnesium-doped zinc oxide (ZnO:Mg) thin films with doping concentration of 0, 2, 4, and 5%. Thin films were deposited onto the glass substrates via the sol-gel spin coating method. The effect of magnesium doping, on the crystal structure, morphology, and band gap for ZnO:Mg thin films has been analyzed by X-ray diffraction (XRD), scanning electron microscopy (SEM), atomic force microscopy (AFM), and UV-Vis spectroscopy. It has been observed that the surface of ZnO thin films is multifractal in nature. However, multifractality and complexity observed to decrease with increasing content of Mg in ZnO thin films due to formation of islands on the surface in accordance with Volmer-Weber growth mechanism. The investigations revealed that crystallinity, microtexture, morphology, and optical properties of the thin films can be tuned by controlling the Mg content within the ZnO lattice. In particular, their optical band gap energies were 3.27, 3.31, 3.34, and 3.33 eV at 0, 2, 4, and 5%, respectively. The prepared thin films of ZnO:Mg with tuned characteristics would have promising applications in optoelectronic devices.