The electronic structure and magnetic behavior of hexagonal rare‐earth diboride RB2 are studied using ab initio density‐functional theory in the DFT + U approach. The effect of the spin–orbit coupling is also investigated and it is found to be a necessary requirement for the accurate description of the magnetic moment. In this paper, we study the magnetic phase stability of RB2 compounds; the band structure and the density of state (DOS) results prove that the coulomb potential and the spin–orbit interaction are keys factors to understand the magnetic properties of these series of materials. In addition, we also explain the behavior of a chemical bond of RB2 compounds through the analysis of the DOS and of the charge density.