Histone deacetylase inhibitors, including valproic acid, selectively induce cellular differentiation and apoptosis in melanoma cells. No published pharmacoepidemiologic studies have explored the association between valproic acid use and melanoma risk. We conducted a retrospective cohort study of adult white Kaiser Permanente Northern California members (n = 2,213,845) from 1997 to 2012 to examine the association between valproic acid use and melanoma risk. Melanoma hazard ratios (HRs) and 95% CIs were estimated using Cox proportional hazards models, adjusted for age, sex, calendar year, and healthcare use. Melanoma incidence was lower among exposed individuals (64.0 exposed vs. 96.2 unexposed per 100,000 person-years, P < 0.001). Exposed individuals had a lower incident melanoma risk (HR = 0.64; 95% CI = 0.51-0.79) in unadjusted analysis, and the estimate was attenuated but significant in adjusted analysis (HR = 0.76, 95% CI = 0.61-0.94). Cumulative exposure based on the number of fills revealed a biologically implausible inverse dose-effect. Exposed individuals were more likely to present with local than regional or distant disease at diagnosis (80/82; 97.6% exposed vs. 12,940/13,971; 92.6% unexposed). Our findings suggest that valproic acid exposure may be associated with decreased melanoma risk and progression, but the cumulative exposure analyses suggest that the observation may be owing to residual confounding.