We aimed to evaluate the association of coffee consumption with different additives, including milk and/or sweetener (sugar and/or artificial sweetener), and different coffee types, with new-onset acute kidney injury (AKI), and examine the modifying effects of genetic variation in caffeine metabolism. 194 324 participants without AKI at baseline in the UK Biobank were included. The study outcome was new-onset AKI. During a median follow-up of 11·6 years, 5864 participants developed new-onset AKI. Compared with coffee non-consumers, a significantly lower risk of new-onset AKI was found in coffee consumers adding neither milk nor sugar to coffee (hazard ratio (HR), 0·86; 95 % CI, 0·78, 0·94) and adding only milk to coffee (HR,0·83; 95 % CI, 0·78, 0·89), but not in coffee consumers adding only sweetener (HR,1·14; 95 % CI, 0·99, 1·31) and both milk and sweetener to coffee (HR,0·96; 95 % CI, 0·89, 1·03). Moreover, there was a U-shaped association of coffee consumption with new-onset AKI, with the lowest risk at 2–3 drinks/d, in unsweetened coffee (no additives or milk only to coffee), but no association was found in sweetened coffee (sweetener only or both milk and sweetener to coffee). Genetic variation in caffeine metabolism did not significantly modify the association. A similar U-shaped association was found for instant, ground and decaffeinated coffee consumption in unsweetened coffee consumers, but not in sweetened coffee consumers. In conclusion, moderate consumption (2–3 drinks/d) of unsweetened coffee with or without milk was associated with a lower risk of new-onset AKI, irrespective of coffee type and genetic variation in caffeine metabolism.