In copper zinc tin sulfide (CZTS) based thin films, copper zinc antisite (CuZn) represents the major p-type acceptor defect with low formation energy. This antisite can create defect-dominated carrier recombination hotspots, which reduces power conversion efficiency. Extrinsic doping in cationic sites of the CZTS thin film during synthesis is an effective way to passivate this defect. It has previously been reported that employing Cd as a dopant can passivate this defect and improve film quality. Injecting toxic Cd into non-toxic CZTS may create more problems than it solves. Simultaneous doping of Cd and other atoms like Mg is hypothesized to accomplish this goal of lowering Cd concentration. For this, it is important to know the effect of doping Cd and Mg separately under analogous experimental conditions. The structural, morphological, and optical properties, as well as the chemical bonding states, of sol-gel spin-coated CZTS thin films were investigated in this study using independent and controlled Cd and Mg doping. The fabrication procedure consisted of two steps: sol-gel spin coating followed by sulfurization. As a solvent for precursors in creating sols for spin coating processes, dimethyl sulfoxide (DMSO) was employed. Each dopant's precursor concentration was chosen to ensure an identical mole percentage of zinc precursor in the solution. The fabricated films were characterized undoped and doped forms using X-ray diffractometry (XRD) with Rietveld refinements, Raman spectroscopy, Field emission scanning electron microscopy (FESEM), 3D profilometry, and Ultraviolet-visible near-infrared (UV-Vis NIR) spectroscopy. The elemental composition ratio and chemical bonding states of the fabricated films were probed by Energy dispersive X-ray spectroscopy (EDS) and X-ray photoelectron spectroscopy (XPS), respectively. Fabricated thin films exhibit distinct synergistic features depending on the dopant types used in the fabrication process. The crystal structure of the doped absorber and the chemical valence states of the other elements (Cu, Zn, Sn, and S) were not changed as shown by XRD, Raman, and XPS analyses. The main diffraction peak at the (112) plane is found at Bragg's diffraction angle of 28.6° for an undoped sample. This peak shifts left upon Cd and Mg doping to 28.2° and 28.4° owing to different ionic radii of dopants relative to Zn ions, which indicates the presence of dopants in the fabricated films. Raman spectroscopy probes the Cu-Sn-S secondary phases: cubic Cu2SnS3 at 305 cm−1 in the undoped sample, tetragonal Cu2SnS3 at 296 cm−1 in the Cd-doped sample, and orthorhombic Cu3SnS4 at 291 cm−1 in the Mg-doped sample. From the EDS results, it appears that 45% of the Zn atoms in both the Cd-doped and Mg-doped samples are partially substituted by Cd and Mg, respectively. The optical band gap for Cd-doped samples decreases from 1.61 eV to 1.56 eV when compared to undoped samples. For Mg-doped samples, the optical band gap shrinks even more to 1.1 eV. This corresponds to shifting of absorbance spectra to higher wavelengths known as “redshift”. Urbach energy is determined to be 284 meV and 1072 meV for Cd and Mg doped samples, respectively, to address band tailing issues. Mg doping enhances crystallite size slightly while decreasing microstrain and dislocation density. The RMS surface roughness of Cd and Mg doped samples is 147 nm and 280 nm, respectively. Nevertheless, the primary peaks of Cu, Zn, Sn, S, Cd, Mg, and O, as well as the secondary photoelectron emission lines of these elements, are all found to be present and identified in both the doped samples. These results imply that Cd …