The local coordination structures around the doping Yb2+ ions in sodium and potassium halides were calculated by using the first-principles supercell model. Both the cases with and without the charge compensation vacancy in the local environment of the doping Yb2+ were calculated to study the effect of the doping on the local coordination structures of Yb2+. Using the calculated local structures, we obtained the crystal-field parameters for the Yb2+ ions doped in sodium and potassium halides by a method based on the combination of the quantum-chemical calculations and the effective Hamiltonian method. The calculated crystal-field parameters were analyzed and compared with the fitted results.