To obtain miniaturization of a sapphire loaded cavity in hydrogen maser, a method is brought forward to design a compact microwave cavity. A cavity with high Q and small size sapphire is achieved through analyzing relationship between parameters and sizes of cavity. The cavity designed is validated and optimized by simulation. Finally an experiment is done to test parameters of the designed cavity, and the experiment value is very close to the computing and simulating result. Parameters and sizes of the new cavity are as follows. Q value is 68,000; Temperature frequency coefficient is - 59.7 kHz/K; Outer diameter of cylindrical cavity is 153mm; Height of cavity is 172mm.