Abstract The structural, electronic and magnetic properties of XYZ compounds (X=Li, Na, K and Rb; Y=Mg, Ca, Sr and Ba; Z=B, Al and Ga) in half-Heusler phase are studied by first principles calculations within density-functional theory. From the spin-polarized calculations, it is found that the compounds XCaB, XSrB, XBaB and LiBaGa are ferromagnetic and metallic whereas the other compounds XMgB, XYAl and XYGa except LiBaGa are non-magnetic and metallic. Among the compounds which exhibit ferromagnetism, XCaB and XSrB (X=Li, Na, and K) exhibit half-metallic (HM) property with an integer magnetic moment of 2.0μB per formula unit at their equilibrium volume. However, other compounds such as RbCaB, RbSrB and XBaB (X=Li, Na, K and Rb) are so-called nearly HMFs and exhibit HMF property at their expanded volume. The magnetic moment mainly originates from the strong spin-polarization of np electrons of Z (B and Ga) atoms and partial involvement of nd electrons of Y atoms. The robustness of half-metallicity against the lattice constant is also calculated. The absence of transition-metal atom makes these compounds important model systems for the study of origin and properties of half-metallic ferromagnetism of s–p electron systems.