Barriers to international trade are known to be large but because of data limitations it is hard to measure them directly for a large number of countries over many years. To address this problem, I derive a micro-founded measure of bilateral trade costs that indirectly infers trade frictions from observable trade data. I show that this trade cost measure is consistent with a broad range of leading trade theories including Ricardian and heterogeneous firms models. In an application I show that U.S. trade costs with major trading partners declined on average by about 40 between 1970 and 2000, with Mexico and Canada experiencing the biggest reductions. (JEL F10, F15)