Background: Food processing has been hypothesised to play a role in cancer development; however, data from large-scale epidemiological studies are scarce. This study investigated the association between dietary intake according to amount of food processing and risk of cancer at 25 anatomical sites using data from the European Prospective Investigation into Cancer and Nutrition (EPIC) study. Methods: This study used data from the prospective EPIC cohort study, which recruited participants between March 18, 1991, and July 2, 2001, from 23 centres in ten European countries. Participant eligibility within each cohort was based on geographical or administrative boundaries. Participants were excluded if they had a cancer diagnosis before recruitment, had missing information for the NOVA food processing classification, or were within the top and bottom 1% for ratio of energy intake to energy requirement. Validated dietary questionnaires were used to obtain information on food and drink consumption. Participants with cancer were identified using cancer registries or during follow-up from a combination of sources, including cancer and pathology centres, health insurance records, and active follow-up of participants. We performed a substitution analysis to assess the effect of replacing 10% of processed foods and ultra-processed foods with 10% of minimally processed foods on cancer risk at 25 anatomical sites using Cox proportional hazard models. Findings: 521 324 participants were recruited into EPIC, and 450 111 were included in this analysis (318 686 [70·8%] participants were female individuals and 131 425 [29·2%] were male individuals). In a multivariate model adjusted for sex, smoking, education, physical activity, height, and diabetes, a substitution of 10% of processed foods with an equal amount of minimally processed foods was associated with reduced risk of overall cancer (hazard ratio 0·96, 95% CI 0·95–0·97), head and neck cancers (0·80, 0·75–0·85), oesophageal squamous cell carcinoma (0·57, 0·51–0·64), colon cancer (0·88, 0·85–0·92), rectal cancer (0·90, 0·85–0·94), hepatocellular carcinoma (0·77, 0·68–0·87), and postmenopausal breast cancer (0·93, 0·90–0·97). The substitution of 10% of ultra-processed foods with 10% of minimally processed foods was associated with a reduced risk of head and neck cancers (0·80, 0·74–0·88), colon cancer (0·93, 0·89–0·97), and hepatocellular carcinoma (0·73, 0·62–0·86). Most of these associations remained significant when models were additionally adjusted for BMI, alcohol and dietary intake, and quality. Interpretation: This study suggests that the replacement of processed and ultra-processed foods and drinks with an equal amount of minimally processed foods might reduce the risk of various cancer types. Funding: Cancer Research UK, l'Institut National du Cancer, and World Cancer Research Fund International.