Background The role of differences in diet on the relationship between socioeconomic factors and cardiovascular diseases remains unclear. We studied the contribution of diet and other lifestyle factors to the explanation of socioeconomic inequalities in cardiovascular diseases. Methods We prospectively examined the incidence of coronary heart disease (CHD) and stroke events amongst 33,106 adults of the EPIC-NL cohort. Education and employment status indicated socioeconomic status. We used Cox proportional models to estimate hazard ratios ((HR (95% confidence intervals)) for the association of socioeconomic factors with CHD and stroke and the contribution of diet and lifestyle. Results During 12 years of follow-up, 1617 cases of CHD and 531 cases of stroke occurred. The risks of CHD and stroke were higher in lowest (HR = 1.98 (1.67;2.35); HR = 1.55 (1.15;2.10)) and lower (HR = 1.50 (1.29;1.75); HR = 1.42 (1.08;1.86)) educated groups than in the highest. Unemployed and retired subjects more often suffered from CHD (HR = 1.37 (1.19;1.58); HR = 1.20 (1.05;1.37), respectively), but not from stroke, than the employed. Diet and lifestyle, mainly smoking and alcohol, explained more than 70% of the educational differences in CHD and stroke and 65% of employment status variation in CHD. Diet explained more than other lifestyle factors of educational and employment status differences in CHD and stroke (36% to 67% vs. 9% to 27%). Conclusion The socioeconomic distribution of diet, smoking and alcohol consumption largely explained the inequalities in CHD and stroke in the Netherlands. These findings need to be considered when developing policies to reduce socioeconomic inequalities in cardiovascular diseases.