Recent experiments on Eu-doped nanocrystals of CsPbX3 (X = Cl, Br) show that Eu exists in the 3+ oxidation state even though it substitutes Pb, which is in the 2+ state in these perovskites. Therefore, the question arises, what is it that leads to the formation of Eu3+ in the nanocrystals of these materials? In order to understand this, we have studied the doping of Eu in a slab (∼1.8 nm thick) of CsPbBr3 using ab initio calculations and explored various possibilities that could lead to the formation of Eu3+ and the occurrence of f-f transitions. These include (1) the presence of a Cs vacancy, (2) the existence of H or OH due to moisture, (3) substitution of O at the surface halogen site, and (4) the possibility of excess halogen around Eu. It is found that the presence of surface oxygen is the most likely reason for the observation of Eu3+ in these nanolayers. Our results show the presence of partially occupied spin-up f states and a magnetic moment of 6.48 μB on Eu that could lead to the possibility of f-f transition in these doped systems. A similar result has also been obtained for Eu doped in CsPbCl3 nanolayers. The calculated change in energy when defects/impurities are present is a favorable indication of finding H, OH, and Br as interstitials and O as substitutional entities but Cs vacancy is unlikely. Additionally, we find that the doping of Eu in nanolayers does not affect the atomic structure, and the cost of doping is also very small, making these perovskites very promising materials for light-emitting diodes and other solid-state lighting applications. © 2020 American Chemical Society.