This article studies optimal mortgage design in a continuous-time setting with volatile and privately observable income, costly foreclosure, and a stochastic market interest rate. We show that the features of the optimal mortgage are consistent with an option adjustable-rate mortgage (option ARM). Under the optimal contract, the borrower is given discretion of how much to repay until his balance reaches a certain limit. The default rates and interest rate payment on the mortgage correlate positively with the market interest rate. Gains from using the optimal contract relative to simpler mortgages are the biggest for those who face more income variability, buy pricey houses given their income level, or make little or no down payment. Our model thus may help to explain a high concentration of option ARMs among riskier borrowers.