In the presented study, (Ni, Mg) co-doped CdS thin films are synthetized using the spin coating method. The Mg incorporation effect on the structural, opto-electrical quality of Cd0.98Ni0.02S with different Mg concentrations (0 wt%, 1wt.%, 3wt, and 5wt.%) are investigated. A polycrystalline nature with a cubic structure oriented to (1 1 1) plane was confirmed by the DRX technique, and the incorporation of Mg in Cd0.98Ni0.02S causes an increase of the grain size. The SEM study exhibits a surface of deposited films is dense and the EDS spectra confirmed the existence of the doped elements. The optical properties show that the doping with 3 at.% of Mg presents the maximum each a value of 90% in visible range, with an increasing in the gap energy from 2.42 eV to 2.49 eV corresponding to increasing of Mg concentration. And also optical parameters were investigated such as α, k, n, ε
r, ε
i, tan δ, σ. The electrical resistivity and conductivity measurements are carried using the four points probe, we find that the electrical resistivity decreases from the 7.30 × 103 (Ohm. cm) to 4.28 × 103 (Ohm. cm) while Mg concentration increases from 0 at% to 5 at%.