  Although chromium trihalides are widely regarded as a promising class of
two-dimensional magnets for next-generation devices, an accurate description of
their electronic structure and magnetic interactions has proven challenging to
achieve. Here, we quantify electronic excitations and spin interactions in
Cr$X_3$ ($X=$~Cl, Br, I) using embedded many-body wavefunction calculations and
fully generalized spin Hamiltonians. We find that the three trihalides feature
comparable $d$-shell excitations, consisting of a high-spin $^4A_2$
$(t^3_{2g}e^0_{g})$ ground state lying 1.5$-$1.7 eV below the first excited
state $^4T_2$ ($t^2_{2g}e^1_{g}$). CrCl$_3$ exhibits a single-ion anisotropy
$A_{\rm sia} = -0.02$ meV, while the Cr spin-3/2 moments are ferromagnetically
coupled through bilinear and biquadratic exchange interactions of $J_1 = -0.97$
meV and $J_2 = -0.05$ meV, respectively. The corresponding values for CrBr$_3$
and CrI$_3$ increase to $A_{\rm sia} = -0.08$ meV and $A_{\rm sia} = -0.12$ meV
for the single-ion anisotropy, $J_1 = -1.21$ meV, $J_2 = -0.05$ meV and $J_1 =
-1.38$ meV, $J_2 = -0.06$ meV for the exchange couplings, respectively. We find
that the overall magnetic anisotropy is defined by the interplay between
$A_{\rm sia}$ and $A_{\rm dip}$ due to magnetic dipole-dipole interaction that
favors in-plane orientation of magnetic moments in ferromagnetic monolayers and
bulk layered magnets. The competition between the two contributions sets
CrCl$_3$ and CrI$_3$ as the easy-plane ($A_{\rm sia}+ A_{\rm dip} > 0$) and
easy-axis ($A_{\rm sia}+ A_{\rm dip} < 0$) ferromagnets, respectively. The
differences between the magnets trace back to the atomic radii of the halogen
ligands and the magnitude of spin-orbit coupling. Our findings are in excellent
agreement with recent experiments, thus providing reference values for the
fundamental interactions in chromium trihalides.
