Coal with a tar yield ≥ 7 %, which is measured in the Gray-King assay, is called tar-rich coal in China. However, the comprehensive impact of coal ranks and depositional environments on tar yield is still unclear. Here, the coal petrology, molecular structure, and depositional environment of the samples were thoroughly investigated to clarify the influence of the coal rank and depositional environment on the tar-rich coal. The difference in the tar yield is attributed to the molecular structure. Concerning Fourier transform infrared (FTIR) spectroscopy, the high tar production resulted from the existence of relatively long aliphatic side chains and high aliphatic hydrogen content. For the 13C nuclear magnetic resonance analysis, the structure of the aliphatic carbon also played a crucial role in tar formation. Among these, the various unstable structural parameters (falH/fas, (fas + fap)/fa', fas/fa', falH/fal*) and weak bonds could improve the tar yield. Furthermore, the molecular structures were also controlled by the coal rank. More specifically, the CH2/CH3 in FTIR and the falH, falH/fa*, fas/fa’ in 13C NMR had similar patterns with coal rank, which was close to the pattern between the coal rank and the tar yield. This effect also indicated that the tar yield was mainly influenced by bridge bonds, aliphatic side chains, and branched aromatic carbon. Between similar coal ranks, the molecular structure differences originated from the depositional environment. For the coal facies, the tissue preservation index (TPI) and vegetation index (VI) were negatively correlated with CH2/CH3, Hal/H, and “A factor”. In contrast, they were positively correlated with the oxidation degree (Io2). The gelification index (GI) was also positively correlated with CH2/CH3 and Hal/H. Consequently, the coal-forming environment with a relatively high degree of decomposition, low woody tissue content, and high gelification can form key molecular structures easier, which is beneficial for the tar yield.