We report an intriguing empirical observation. The relationship between corruption and output depends on the economy's degree of openness: in open economies, corruption and GNP per capita are strongly negatively correlated, but closed economies display no relationship at all. This stylized fact is robust to a variety of different empirical specifications. In particular, the same basic pattern persists if we use alternative measures of openness, if we focus on different time periods, if we restrict the sample to include only highly corrupt countries, and if we restrict attention to specific geographic areas or to poor countries. We find that the degree of financial openness is primarily what determines whether corruption and output are correlated. Moreover, corruption is negatively related to capital accumulation in open economies, but not in closed economies. We present a model, consistent with these findings, in which the main channel through which corruption affects output is capital drain.