Coffee is a widely consumed beverage with potential benefits for various chronic diseases. Its effect on reducing erectile dysfunction (ED) risk is unclear. This Mendelian randomization (MR) study investigates the impact of coffee/caffeine consumption on ED. Two sets of coffee consumption-associated genetic variants at the genome-wide significance level were obtained from recent studies of coffee consumption. Taking into account other sources of caffeine, genetic variants associated with caffeine consumption from tea were also obtained. The inverse variance weighted (IVW) method was utilized as the primary analysis. Sensitivity analysis methods and meta-analysis methods were performed to confirm the robustness of the results, while the genetic variants associated with confounders, e.g., diabetes and hypertension, were excluded. Genetically predicted coffee/caffeine consumption was unlikely to be associated with the risk of ED in the Bovijn datasets, with similar directional associations observed in the FinnGen datasets. The combined odds ratio for ED was 1.011 (95% CI 0.841-1.216, p=0.906) for coffee consumption from the genome-wide meta-analysis, 1.049 (95% CI 0.487-2.260, p=0.903) for coffee consumption from the genome-wide association study, and 1.061 (95% CI 0.682-1.651, p=0.793) for caffeine from tea. Using genetic data, this study found no association between coffee/caffeine consumption and the risk of ED.