Mg-doped CaCu 3− x Mg x Ti 4 O 12 ( x =0, 0.05, 0.1, 0.15, 0.2, at.%) thin films were prepared by a modified sol−gel method. A comparative study on the microstructure and electrical properties of Mg-doped CaCu 3 Ti 4 O 12 (CCTO) thin films was carried out. The grain sizes of the Mg-doped CCTO thin films were smaller in comparison to the undoped CCTO films. Furthermore, compared to undoped CCTO films, Mg-doped CCTO thin films obtained higher dielectric constant as well as excellent frequency stability. Meanwhile, Mg doping could reduce the dielectric loss of CCTO thin films in the frequency range of 10 4 −10 6 Hz. The results showed that the Mg-doped CCTO thin films had the better electrical characteristics compared with the undoped CCTO films. The nonlinear coefficient of Mg-doped CCTO thin films at x =0.15 and x =0.1 was improved to 7.4 and 6.0, respectively.