Depression and anxiety co-occur with substance use and abuse at a high rate. Ascertaining whether substance use plays a causal role in depression and anxiety is difficult or impossible with conventional observational epidemiology. Mendelian randomisation uses genetic variants as a proxy for environmental exposures, such as substance use, which can address problems of reverse causation and residual confounding, providing stronger evidence about causality. Genetic variants can be used instead of directly measuring exposure levels, in order to gain an unbiased estimate of the effect of various exposures on depression and anxiety. The suitability of the genetic variant as a proxy can be ascertained by confirming that there is no relationship between variant and outcome in those who do not use the substance. At present, there are suitable instruments for tobacco use, so we use that as a case study. Proof-of-principle Mendelian randomisation studies using these variants have found evidence for a causal effect of smoking on body mass index. Two studies have investigated tobacco and depression using this method, but neither found strong evidence that smoking causes depression or anxiety; evidence is more consistent with a self-medication hypothesis. Mendelian randomisation represents a technique that can aid understanding of exposures that may or may not be causally related to depression and anxiety. As more suitable instruments emerge (including the use of allelic risk scores rather than individual single nucleotide polymorphisms), the effect of other substances can be investigated. Linkage disequilibrium, pleiotropy, and population stratification, which can distort Mendelian randomisation studies, are also discussed.