BackgroundLittle is known about how the residential distance to the coast is associated with incident myocardial infarction (MI) and which mechanisms may explain the association. We aim to explore this association using data from a prospective, population-based cohort with unprecedented sample size and broad geographical coverage.MethodsThree hundred seventy-seven thousand three hundred forty participants from the UK Biobank were included. Results4,059 MI occurred during median 8.0 years follow-up. Using group (<1 km) as reference, group (20-50 km) was associated with a lower risk of MI (hazard ratio, HR 0.79, 95% CI 0.64-0.98) and a U-shaped relation between distance to the coast and MI was shown with the low-risk interval between 32 km and 64 km (Pnonlinear=0.0012). Using participants of the intermediate region (32-64 km) as a reference, participants of the offshore region (<32 km) and inland region (>64 km) were both associated with a higher risk of incident MI (HR 1.12, 95% CI 1.04-1.21 and HR 1.09, 95% CI 1.01-1.18, respectively). HR for offshore region (<32 km) was larger in subgroup with low total physical activity (<24 hours/week) (HR 1.24, 95% CI 1.09-1.42, Pinteraction= 0.043). HR for inland region (>64 km) was larger in subgroup in urban area (HR 1.12, 95% CI 1.03-1.22, Pinteraction=0.065) and in subgroup of high nitrogen dioxide air pollution (HR 1.29, 95% CI 1.11-1.50, Pinteraction=0.021).ConclusionWe found a U-shaped association between residential distance to the coast and incident MI, and the association was modified by physical activity, population density, and air pollution.