Underground cavities mainly exhibit irregular forms in nature. Due to the difficulties in describing the geometrical shape of irregular cavities and theoretically analyzing such cavities, irregular cavities are generally simplified as regular circular, elliptical or polygonal shapes in most studies. The purpose of this paper is to quantitatively describe the shape of irregular cavities using Fourier descriptors from inverse discrete Fourier transform (IDFT) theory and to translate the generation process of irregular cavity contours into a conversion between discrete frequency-domain and time-domain signals. Based on this approach, the stability analysis of irregular underground cavities is conducted using the upper bound finite element limit analysis (UB-FELA) method. The upper bound stability numbers (γcrD/c) and collapse mechanisms are presented for a series of irregular cavity depth-to-diameter ratios (H/D), internal friction angles (φ) and geometrical shape descriptors (D2, D3 and D8). The obtained results demonstrate that the stability numbers increase with increasing φ and decrease with increasing H/D and descriptor values (D2, D3 and D8). The failure mechanisms are significantly asymmetrical due to the contour fluctuations of the irregular cavity. Specifically, interlaced shear bands form between the adjacent fluctuations on the surface of the irregular cavity, which considerably differs from the failure mechanism of regular cavities. Local shear failure is the main failure form for the soil around the cavity. An obvious bottom bulge phenomenon is observed in the cavity at small internal friction angles.