We develop an equilibrium model of the debt maturity choice of firms, in the presence of fixed issuance costs in the primary debt market, and search frictions in the secondary debt market. Liquidity in the secondary market is related to the ratio of buyers to sellers, which is determined in equilibrium via the free entry of buyers. Short maturities improve the bargaining position of sellers in the secondary debt market and hence reduce the interest rate firms need to offer in the primary market. Long maturities reduce re-issuance costs. The optimally chosen maturity trades off both considerations. We find that the laissez-faire equilibrium exhibits inefficiently short maturity choices because an individual firm does not internalize that choosing a longer maturity increases the expected gains from trade in the secondary market, which attracts more buyers, and hence also facilitates the sale of debt issued by other firms.