IBD, comprising Crohn's disease and ulcerative colitis, is a chronic immunologically mediated disease at the intersection of complex interactions between genetics, environment and gut microbiota. Established high-prevalence populations of IBD in North America and Europe experienced the steepest increase in incidence towards the second half of the twentieth century. Furthermore, populations previously considered 'low risk' (such as in Japan and India) are witnessing an increase in incidence. Potentially relevant environmental influences span the spectrum of life from mode of childbirth and early-life exposures (including breastfeeding and antibiotic exposure in infancy) to exposures later on in adulthood (including smoking, major life stressors, diet and lifestyle). Data support an association between smoking and Crohn's disease whereas smoking cessation, but not current smoking, is associated with an increased risk of ulcerative colitis. Dietary fibre (particularly fruits and vegetables), saturated fats, depression and impaired sleep, and low vitamin D levels have all been associated with incident IBD. Interventional studies assessing the effects of modifying these risk factors on natural history and patient outcomes are an important unmet need. In this Review, the changing epidemiology of IBD, mechanisms behind various environmental associations and interventional studies to modify risk factors and disease course are discussed.