Colorectal cancer is one of the so-called westernized diseases and the second leading cause of cancer death worldwide. On the basis of global epidemiological and scientific studies, evidence suggests that the risk of colorectal cancer is increased by processed and unprocessed meat consumption but suppressed by fibre, and that food composition affects colonic health and cancer risk via its effects on colonic microbial metabolism. The gut microbiota can ferment complex dietary residues that are resistant to digestion by enteric enzymes. This process provides energy for the microbiota but culminates in the release of short-chain fatty acids including butyrate, which are utilized for the metabolic needs of the colon and the body. Butyrate has a remarkable array of colonic health-promoting and antineoplastic properties: it is the preferred energy source for colonocytes, it maintains mucosal integrity and it suppresses inflammation and carcinogenesis through effects on immunity, gene expression and epigenetic modulation. Protein residues and fat-stimulated bile acids are also metabolized by the microbiota to inflammatory and/or carcinogenic metabolites, which increase the risk of neoplastic progression. This Review will discuss the mechanisms behind these microbial metabolite effects, which could be modified by diet to achieve the objective of preventing colorectal cancer in Western societies.