The conventional planar grating (CPG) system has a complicated optical structure, which causes complexities in various aspects, e.g., a variety of processes such as fabrication, assembly, and alignment. The size of the CPG cannot be further reduced due to the minimum optical path length requirement imposed by the spectral resolution. This paper proposes an ultracompact grating system that is turned into a reality by a shorter optical path length through a specified grating profile. Our proposed microphotolithographic inductive coupled plasma - reactive ion etching process demonstrates that an arbitrary grating profile with high aspect ratio and small surface roughness can be achieved. The aberrations of different wavelengths are greatly reduced or eliminated. An etching depth of 30 to 60 μm is achieved. The surface roughness meets the requirement of λ/10 (50 nm). The size of the grating system is 30 × 30 × 2 mm. The resolving power R reaches 600 to 700 in the visible region.