To quantitatively evaluate the substitution energies of Cd atom for Cu, Zn, or Sn atom in indium-free photovoltaic semiconductors Cu2ZnSnS4 (CZTS) and Cu2ZnSnSe4 (CZTSe), first-principles pseudopotential calculations using plane-wave basis functions were performed. The substitution energies of Cd atom in kesterite-type CZTS and CZTSe were calculated in consideration of the atomic chemical potentials of the constituent elements of Cu, Zn, Sn, and the doping atom of Cd. During the chemical bath deposition (CBD) of the CdS layer on the CZTS or CZTSe layer, Cu, Zn, and Cd atoms dissolved in the ammonia aqueous solution and formed [Cu(NH3)2]+, [Zn(NH3)4]2+, and [Cd(NH3)4]2+ complex ions. Therefore, the chemical potentials of Cu, Zn, and Cd atoms in [Cu(NH3)2]+, [Zn(NH3)4]2+, and [Cd(NH3)4]2+ complex ions were calculated. We found that the substitution energies of n-type CdCu and charge-neutral CdZn in CZTS and CZTSe are smaller than that of p-type CdSn. The substitution energies of CdCu in CZTS and CZTSe are smaller than that in chalcopyrite-type CuInSe2 (CIS). However, the substitution energies of CdCu, CdZn, and CdSn are positive values. The formation energy of charge-neutral Cd doping with the Cu vacancy (CdCu + VCu) pair is a negative value and greatly smaller than those of donor-type CdCu and neutral CdZn in CZTS and CZTSe. These results indicate that the charge-neutral (CdCu + VCu) vacancy pair is easily formed during the CBD of the CdS layer on the CZTS or CZTSe layer. A small amount of n-type CdCu and neutral CdZn would also be formed.