In this work, we present the analysis and design of a perfect metamaterial absorber (MA) based on quarter mode rectangular cavity in the terahertz region. This structure is consisted of a metal plate where three different size quarter mode rectangular cavities are vertically placed on. Based on rectangular-cavity-theory, a formula is proposed to calculate the resonant frequency, which provides a guidance for designing MAs of such type. In terms of normal incidence, the simulated results show that the MA has three resonance points on 4.1301 THz, 4.6051 THz and 5.1088 THz, respectively, which is in good agreement with the calculated results. Furthermore, we present the distribution of E-field in the cavity and use the standing wave theory to explain the physical mechanism of the perfect absorption. These results verify the application of resonant cavities in the field of MA.