One of the grand challenges in ultrafast science is real-time visualization of the microscopic structural evolution on atomic time and length scales. A promising pump-probe technique using a femtosecond laser pulse to initiate the ultrafast dynamics and another ultrashort electron pulse to probe the resulting changes has been developed and widely used to study ultrafast structural dynamics in chemical reactions, phase transitions, charge density waves, and even biological functions. In the past three decades, a number of different ultrafast electron guns have been developed to generate ultashort electron sources, mainly including hybrid electron gun with radio-frequency (RF) cavities for compressing the pulse broadening, relativistic electron gun for suppressing the coulomb interaction, single-electron pulses without space charge effect and compact direct current (DC) electron gun for minimizing the electron propagation distance. At present, these developments with different final electron energy and available total charge have improved the time response of ultrafast electron diffraction (UED) setups to a new frontier approaching to 100 fs regime. Although enormous efforts have been made, the superior capabilities and potentials of ultrafast electron diffraction (UED) are still hindered by space-charge induced pulse broadening. Besides, the penetration depth of electrons increases with the electron energy, while the scattering probability of electrons has the opposite consequence. Thus, in addition to the temporal resolution enhancement, it is also important that the electron energy should be tunable in a wide range to meet the requirements for samples with different thickness. Here in this work, we design a novel ultra-compact electron gun which combines a well-designed cathode profile, thereby providing a uniform field and a movable anode configuration to achieve a temporal resolution on the order of 100 fs over an accelerating voltage range from 10 kV to 125 kV. By optimizing the design of the high-voltage electrode profile, the field enhancement factor on the axis and along the cathode surface are both less than ~4% at different cathode-anode spacings, and thus the maximum on-axis field strength of ~10 MV/m is achieved under various accelerating voltages. This effectively suppresses the space charge broadening effect of the electron pulse. Furthermore, the anode aperture is designed as a stepped hole in which the dense sample grid can be placed, and the sample under study is directly supported by the grid and located at the anode, which reduces the cathode-to-sample distance, thus minimizing the electron pulse broadening from the cathode to sample. Moreover, the defocusing effect caused by the anode hole on the electron beam can be effectively reduced, therefore improving the lateral focusing performance of the electron beam.