GaN thin films have been doped with varying Er concentrations (0.01–10 at. %) during molecular-beam-epitaxy growth. As expected, the visible and infrared (IR) emissions, from photoluminescence (PL) and electroluminescence (EL), are a strong function of Er concentration. We report on the determination of an optimum Er doping level for PL and EL intensity. Secondary ion mass spectroscopy and Rutherford backscattering measurements showed that the Er concentration in GaN increased exponentially with Er cell temperature. PL and EL intensity of green emission at 537 and 558 nm, due to Er 4f–4f inner shell transitions, exhibited a maximum at ∼1 at. % Er. IR PL intensity at 1.54 μm, due to another Er transition, revealed the same maximum for ∼1 at. % Er concentration. PL lifetime measurements at 537 nm showed that samples with Er concentration ≪1 at. % had a lifetime of ∼5 μs. For Er concentration ≥1 at. %, the lifetime decreased rapidly to values below 1 μs. This concentration quenching is believed to be due to a combination of Er cross relaxation and energy transfer to GaN defects, eventually followed by precipitation. This conclusion is supported by x-ray diffraction measurements. As a result, we have determined that the optimum Er doping concentration into GaN is ∼1 at. %. © 2001 American Institute of Physics.