This paper examines the impact of membership in the European Union on foreign direct investments (FDI). In contrast to previous studies, the overall effect of EU membership is disaggregated by countries that joined the EU before 2004 (EU15) and those that joined after 2004 (CEE). This disaggregation is motivated by differences between the two groups in terms of their historical background, GDP levels, and motives for FDI. Furthermore, the effects of EU membership are estimated at the country level. Using a structural FDI gravity model and applying recent advances in the gravity estimation literature, it is shown that membership of the EU has a substantial positive impact on both inward and outward FDI stocks. In particular, there is considerable heterogeneity in the impact of EU membership, with EU15 countries experiencing mainly an increase in inward FDI, while CEE countries experience a surge in outward FDI.