In this study, we performed molecular dynamics (MD) simulations of the filling process of few-nanometer-wide trenches with various resist materials in ultraviolet nanoimprint lithography (UV-NIL) to identify the main molecular features necessary for a successful filling process. The 2- and 3-nm wide trenches were successfully filled with the resist materials that had (experimentally determined) viscosities less than 10 mPa·s. The resist composed of a three-armed bulky and highly viscous molecule could not fill the trenches. The radius of gyration of this molecule was smaller than half of the distance in which the first peak of its radial distribution function occurred. The available shapes of 1,6-hexanediol diacrylate (HDDA) and tri(propylene glycol) diacrylate (TPGDA), which are linear photopolymers, were compared to reveal that TPGDA is more flexible and adopts more conformations than HDDA. The terminal functional groups of TPGDA can be close due to its flexibility, which would increase the probability of intramolecular crosslinking of the molecule. This simulation result could explain the difference in hardness between the UV-cured HDDA and TPGDA based materials observed by experiments. The findings revealed by our MD simulations provide useful information for selecting and designing resists for fine patterning by UV-NIL.