Scanning electron microscope-cathodoluminescence (SEM-CL) analysis was performed for neodymium–iron–boron (NdFeB) and samarium–cobalt (Sm–Co) magnets to analyze the rare-earth elements present in the magnets. We examined the advantages of SEM-CL analysis over conventional analytical methods such as SEM-energy-dispersive X-ray (EDX) spectroscopy and SEM-wavelength-dispersive X-ray (WDX) spectroscopy for elemental analysis of rare-earth elements in NdFeB magnets. Luminescence spectra of chloride compounds of elements in the magnets were measured by the SEM-CL method. Chloride compounds were obtained by the dropwise addition of hydrochloric acid on the magnets followed by drying in vacuum. Neodymium, praseodymium, terbium, and dysprosium were separately detected in the NdFeB magnets, and samarium was detected in the Sm–Co magnet by the SEM-CL method. In contrast, it was difficult to distinguish terbium and dysprosium in the NdFeB magnet with a dysprosium concentration of 1.05 wt% by conventional SEM-EDX analysis. Terbium with a concentration of 0.02 wt% in an NdFeB magnet was detected by SEM-CL analysis, but not by conventional SEM-WDX analysis. SEM-CL analysis is advantageous over conventional SEM-EDX and SEM-WDX analyses for detecting trace rare-earth elements in NdFeB magnets, particularly dysprosium and terbium.