BACKGROUND: Fluoropyrimidine treatment can result in severe toxicity in up to 30% of patients and is often the result of reduced activity of the key metabolic enzyme dihydropyrimidine dehydrogenase (DPD), mostly caused by genetic variants in the gene encoding DPD (DPYD). We assessed the effect of prospective screening for the four most relevant DPYD variants (DPYD*2A [rs3918290, c.1905+1G>A, IVS14+1G>A], c.2846A>T [rs67376798, D949V], c.1679T>G [rs55886062, DPYD*13, I560S], and c.1236G>A [rs56038477, E412E, in haplotype B3]) on patient safety and subsequent DPYD genotype-guided dose individualisation in daily clinical care. METHODS: In this prospective, multicentre, safety analysis in 17 hospitals in the Netherlands, the study population consisted of adult patients (≥18 years) with cancer who were intended to start on a fluoropyrimidine-based anticancer therapy (capecitabine or fluorouracil as single agent or in combination with other chemotherapeutic agents or radiotherapy). Patients with all tumour types for which fluoropyrimidine-based therapy was considered in their best interest were eligible. We did prospective genotyping for DPYD*2A, c.2846A>T, c.1679T>G, and c.1236G>A. Heterozygous DPYD variant allele carriers received an initial dose reduction of 25% (c.2846A>T and c.1236G>A) or 50% (DPYD*2A and c.1679T>G), and DPYD wild-type patients were treated according to the current standard of care. The primary endpoint of the study was the frequency of severe (National Cancer Institute Common Terminology Criteria for Adverse Events version 4.03 grade ≥3) overall fluoropyrimidine-related toxicity across the entire treatment duration. We compared toxicity incidence between DPYD variant allele carriers and DPYD wild-type patients on an intention-to-treat basis, and relative risks (RRs) for severe toxicity were compared between the current study and a historical cohort of DPYD variant allele carriers treated with full dose fluoropyrimidine-based therapy (derived from a previously published meta-analysis). This trial is registered with ClinicalTrials.gov, number NCT02324452, and is complete. FINDINGS: Between April 30, 2015, and Dec 21, 2017, we enrolled 1181 patients. 78 patients were considered non-evaluable, because they were retrospectively identified as not meeting inclusion criteria, did not start fluoropyrimidine-based treatment, or were homozygous or compound heterozygous DPYD variant allele carriers. Of 1103 evaluable patients, 85 (8%) were heterozygous DPYD variant allele carriers, and 1018 (92%) were DPYD wild-type patients. Overall, fluoropyrimidine-related severe toxicity was higher in DPYD variant carriers (33 [39%] of 85 patients) than in wild-type patients (231 [23%] of 1018 patients; p=0·0013). The RR for severe fluoropyrimidine-related toxicity was 1·31 (95% CI 0·63-2·73) for genotype-guided dosing compared with 2·87 (2·14-3·86) in the historical cohort for DPYD*2A carriers, no toxicity compared with 4·30 (2·10-8·80) in c.1679T>G carriers, 2·00 (1·19-3·34) compared with 3·11 (2·25-4·28) for c.2846A>T carriers, and 1·69 (1·18-2·42) compared with 1·72 (1·22-2·42) for c.1236G>A carriers. INTERPRETATION: Prospective DPYD genotyping was feasible in routine clinical practice, and DPYD genotype-based dose reductions improved patient safety of fluoropyrimidine treatment. For DPYD*2A and c.1679T>G carriers, a 50% initial dose reduction was adequate. For c.1236G>A and c.2846A>T carriers, a larger dose reduction of 50% (instead of 25%) requires investigation. Since fluoropyrimidines are among the most commonly used anticancer agents, these findings suggest that implementation of DPYD genotype-guided individualised dosing should be a new standard of care. FUNDING: Dutch Cancer Society