Nonalcoholic fatty liver disease (NAFLD) is a pressing public health concern. NAFLD is recognized as a disease with systemic involvement. Erectile dysfunction is a prevalent condition among men. The study examined the relationship between NAFLD, assessed via U.S. Fatty Liver Index (USFLI), and erectile dysfunction. The study used cross-sectional data from the National Health and Nutrition Examination Survey conducted between 2001 and 2004 to examine the health of those over 20 years of age, collecting details on their erectile dysfunction, USFLI, and several other essential variables. A USFLI score equal to or exceeding 30 was chosen to diagnose NAFLD, while a USFLI score below 10 was utilized to exclude the presence of fatty liver. There were 3763 participants, with 29.1% (1095/3763) who experienced erectile dysfunction. After accounting for all potential covariates, USFLI was positively associated with erectile dysfunction (OR, 1.02; 95% CI, 1.02 ~ 1.03; P < 0.001). Compared with individuals with Q1 (USFLI < 10), the adjusted odds ratio values for USFLI and erectile dysfunction in Q2 (10 ≤ USFLI < 30) and Q3 (USFLI ≥ 30, NAFLD) were 1.84 (95% CI: 1.46 ~ 2.32, p < 0.001) and 2.18 (95% CI: 1.66 ~ 2.87, p < 0.001), respectively. The association USFLI and erectile dysfunction exhibited an L-shaped curve (nonlinear, P = 0.014). The odds ratio value of developing erectile dysfunction was 1.03 (95% CI: 1.021 ~ 1.04, P < 0.001) in participants with USFLI < 50.18. This study identified a positive correlation between USFLI and erectile dysfunction within the adult American population. Our findings imply that NAFLD might constitute an independent risk factor for erectile dysfunction.