In vitro and animal studies suggest that bioactive constituents of coffee and tea may have anticarcinogenic effects against cutaneous melanoma; however, epidemiological evidence is limited to date. We examined the relationships between coffee (total, caffeinated or decaffeinated) and tea consumption and risk of melanoma in the European Prospective Investigation into Cancer and Nutrition (EPIC). EPIC is a multicentre prospective study that enrolled over 500,000 participants aged 25–70 years from ten European countries in 1992–2000. Information on coffee and tea drinking was collected at baseline using validated country‐specific dietary questionnaires. We used adjusted Cox proportional hazards regression models to calculate hazard ratios (HR) and 95% confidence intervals (95% CI) for the associations between coffee and tea consumption and melanoma risk. Overall, 2,712 melanoma cases were identified during a median follow‐up of 14.9 years among 476,160 study participants. Consumption of caffeinated coffee was inversely associated with melanoma risk among men (HR for highest quartile of consumption vs. non‐consumers 0.31, 95% CI 0.14–0.69) but not among women (HR 0.96, 95% CI 0.62–1.47). There were no statistically significant associations between consumption of decaffeinated coffee or tea and the risk of melanoma among both men and women. The consumption of caffeinated coffee was inversely associated with melanoma risk among men in this large cohort study. Further investigations are warranted to confirm our findings and clarify the possible role of caffeine and other coffee compounds in reducing the risk of melanoma.