This paper describes an optimized analytical procedure for determining the composition of alkaline niobate-based lead-free piezoceramics by energy-dispersive X-ray spectroscopy (EDXS) in a transmission electron microscope (TEM). To discriminate the material-specific composition from the artifacts introduced during the EDXS/TEM analyses, the effects of radiation damage and the absorption of the characteristic X-ray lines were studied in detail. The optimized, quantitative EDXS analysis was tested on sodium potassium niobate with the nominal composition K0.5Na0.5NbO3 (KNN) by applying KNbO3 and NaNbO3 as standards. The results obtained indicate that KNbO3 is more radiation sensitive than NaNbO3. A similar degradation was confirmed in KNN, where the loss of potassium was higher than that of sodium. In addition, the degradation of the KNN was associated with a severe oxygen loss and the reduction of niobium. To achieve highly reliable, quantitative analyses and to preserve good counting statistics, the optimum conditions for the EDXS/TEM analyses were found at an electron dose rate of 0.4 pA/nm2 and an acquisition time of around 200 s in the specimen thickness range between 30 and 200 nm.