Sun exposure is a major risk factor for skin cancer and is also an important source of vitamin D. We tested the hypothesis that elevated plasma 25-hydroxyvitamin D (25-OH-vitD) associates with increased risk of non-melanoma and melanoma skin cancer in the general population. We measured plasma 25-OH-vitD in 10,060 white individuals from the Danish general population. During 28 years of follow-up, 590 individuals developed non-melanoma skin cancer and 78 developed melanoma skin cancer. Increasing 25-OH-vitD levels, by clinical categories or by seasonally adjusted tertiles, were associated with increasing cumulative incidence of non-melanoma skin cancer (trend P=2 × 10(-15) and P=3 × 10(-17)) and melanoma skin cancer (P=0.003 and P=0.001). Multivariable adjusted hazard ratios of non-melanoma skin cancer were 5.04 (95% confidence interval (CI): 2.78-9.16) for 25-OH-vitD ≥50 vs. <25 nmol l(-1), and 4.02 (2.45-6.60) for top versus bottom tertile. Multivariable adjusted hazard ratios of melanoma skin cancer were 4.7 (0.96-23.3) for 25-OH-vitD ≥50 vs. <25 nmol l(-1), and 6.3 (1.38-28.8) for top versus bottom tertile. The absolute 20-year risk was 11% for non-melanoma skin cancer and 1.5% for melanoma skin cancer, in participants with age >60 years, 25-OH-vitD winter levels ≥50 nmol l(-1), and performing outdoor exercise. In conclusion, we show that increasing levels of 25-OH-vitD are associated with increased risk of non-melanoma and melanoma skin cancer.