GaN/AlGaN high electron mobility transistors (HEMTs) are important devices due to their high-frequency and high-power applications. The two-dimensional (2D) electron density in AlGaN/GaN heterostructures is essential for the design of the state-of-the-art HEMTs. Here, the electro-absorption of GaN/AlGaN HEMTs was investigated using photoluminescence excitation (PLE), which is a sensitive and noncontact optical technique. The built-in electric fields of the GaN and AlGaN layers in HEMTs were derived from the Stark effect in PLE. According to the discontinuity in the displacement electric fields, the 2D electron density in the heterostructures can be estimated from PLE, which agrees with the values obtained from the Hall-effect measurements.