Characteristic X-Rays are generated when excited sample atoms undergo a relaxation process. For that the atoms need to be excited first and this can be done with high energy electromagnetic radiation (in XRF) or accelerated particles such as electrons (in SEM). The primary beam kicks out an inner shell electron and a vacant spot is left behind. As this state is unstable, a higher shell electron will soon move into this vacant spot and during this process energy is emitted in the form of X-Rays. This emitted radiation has a specific energy which depends on the binding energies of the two electrons that participated in this process. If this emitted ( characteristic ) x-ray radiation is detected then the composition of the material can be measured.