Electron beam lithography is a critical technology for achieving high-precision nanoscale patterning. The presence of resist residues in the structures can significantly affect subsequent processes such as etching and lift-off. However, the evaluation and optimization of resist residues currently relies on qualitative observations like scanning electron microscopy (SEM), necessitating multiple experiments to iteratively optimize exposure parameters, which is not only labor-intensive but also costly. Here, we propose a quantitative method to evaluate resist residues. By processing the obtained SEM images using a threshold segmentation algorithm, we segmented the resist structure region and the residual resist region in the images. The grayscale values of these two regions are identified, and the residues are quantified based on the ratio of these values. Furthermore, a relationship curve between the residue amount and the exposure dose is plotted to predict the optimal exposure dose. To validate this method, we fabricated hydrogen silsesquioxane annular grating structures with 30 nm linewidth and analyzed the residue levels over an exposure dose range of 2000-2500μC cm-2, predicting the optimal dose to be 1800μC cm-2and confirming this through experiments. Additionally, we applied the method to polymethyl methacrylate and ZEP-520A structures, achieving similarly accurate results, further confirming the method's general applicability. This method has the potential to reduce experimental costs and improve yield and production efficiency in nano fabrication.