ObjectiveThe VITAL trial of vitamin D supplementation suggested a possible protective effect for autoimmune diseases but uncertainties remain. We investigated potential causal effects of vitamin D on composite and individual autoimmune diseases using Mendelian randomization. MethodsWe used data from 332,984 participants of the UK Biobank of whom 23,089 had at least one autoimmune disease defined using ICD code and/or self-report. Diseases were further considered in mechanistic subgroups driven by “autoimmunity” (n = 12,774) or “autoinflammation” (n = 11,164), then individually. We selected variants within gene regions implicated in vitamin D biology to generate a weighted genetic score. We performed population-wide analysis using the ratio method, then examined non-linear effects across five quantiles based on 25-hydroxycholecalciferol levels. ResultsGenetically-predicted vitamin D was associated with lower risk of diseases in the autoinflammation group (OR 0.95 per 10 ng/ml increase in 25-hydroxycholecalciferol; 95%CI 0.91–0.99; p = 0.03) but not the autoimmunity group (OR 0.99; 95%CI 0.95–1.03; p = 0.64) or combined. When considering individual diseases, genetically-predicted vitamin D was associated with lower risk of psoriasis (OR 0.91; 95%CI 0.85–0.97; p = 0.005), the most common disease in the autoinflammation group, and suggestively with systemic lupus erythematosus (OR 0.84; 95%CI 0.69–1.02; p = 0.08); results were replicated using data from independent studies. We found no evidence for a plausible non-linear relationship between vitamin D and any outcome. ConclusionsWe found genetic evidence to support a causal link between 25-hydroxycholecalciferol concentrations and psoriasis and systemic lupus erythematosus. These results have implications for potential disease prevention strategies, and the interpretation and design of vitamin D supplementation trials.