We develop a closed form formula for the value of a fixed-rate residential mortgage that includes the provision that the borrower can prepay at any time with no penalty. The value of the mortgage equals the expectation, under the risk neutral probability measure, of the future cash flows. We model future cash flows by estimating an empirical model of prepayment behavior. A second change of measure leads to a closed form expression for the expectation. The closed form values explain most of the time series variation in MBS prices. The closed form formula significantly shortens the time to calculate mortgage values and durations and can be a useful tool for portfolio management and hedging.