This article studies optimal capital structure when firms learn from financial markets. We present a tractable model of stock market feedback with imperfect information aggregation. Debt issuance affects speculators’ incentives to trade both directly, by changing the payoff structure of equity holders, and indirectly, through an asset substitution effect. We show that issuing debt can increase market informativeness and firm value, and may eliminate a coordination failure equilibrium with no provision of market information. We derive the optimal capital structure in this setting and present novel empirical predictions regarding the relationship between market frictions, market informativeness, and capital structure. Once the effect of debt on market informativeness is considered, risky debt does not necessarily lead to risk shifting.