The potential effects of long-term occupational exposure to formaldehyde (FA) on human semen quality is not clear. To assess whether long-term occupational exposure to FA is associated with semen quality. This population-based cohort study was conducted from June 1 to June 30, 2021, in Xi'an, China. Participants were adults aged 23 to 40 years who had lived in the study area for 24 months or longer. Data analysis was performed from September 1 to October 1, 2021. Long-term occupational exposure to FA was measured using a formaldehyde detector, and the FA exposure index (FEI) was calculated as follows: FEI = final concentration of FA (mg/m3) × work time during a workday (hour) × cumulative workdays (year). Semen samples were collected by masturbation after 3 to 7 days of abstinence and were then assessed by the computer-automated semen analysis system, Baso-Papanicolaou staining, and sperm-chromatin structure assay. A total of 205 men (mean [SD] age, 29.49 [3.64] years), with 124 individuals in the FA exposure group (mean [SD] FEI, 73.72 [54.86]) and 81 age-matched controls, were included in the final analysis. Long-term personal occupational exposure to FA was significantly associated with poor semen quality. Specifically, a 1-unit increase in FEI was associated with a change of -0.99% (95% CI, -1.00% to -0.98%) in total sperm motility, -0.99% (95% CI, -0.99% to -0.97%) in progressive sperm motility, -0.05% (95% CI, -0.08% to -0.02%) in curvilinear velocity, -0.07% (95% CI, -0.10% to -0.04%) in straight line velocity, -0.07% (95% CI, -0.10% to -0.04%) in time-average velocity, -0.98% (95% CI, -0.99% to -0.93%) in normal sperm morphology, -0.24% (95% CI, -0.35% to -0.11%) in seminal neutral glucosidase, -0.61% (95% CI, -0.66% to -0.56%) in seminal plasma zinc, 0.52% (95% CI, 0.15% to 1.02%) in beat cross frequency, and 0.10% (95% CI, 0.06% to 0.14%) in the DNA fragmentation index. These associations remained significant after adjusting for confounding factors. Furthermore, subgroup analysis found that high levels of oxidative stress might promote the associations between FA exposure and semen quality. This study found an association between long-term occupational exposure to FA and semen quality. This deterioration was dose and time dependent and might be induced by oxidative stress.