Abstract success in international trade depends, among other things, on distance from markets. Most new economic geography models focus on the distance between countries. In contrast, much less theorizing and empirical analysis have focused on how distances within a country—for instance, due to the location behavior of exporting firms—matter to international trade. In this paper, we contribute to the literature on the latter by offering a theoretical model to explain the optimal distance that an export-oriented firm would locate from a port. We present empirical evidence in support of the model.