We derive the first closed-form optimal mortgage refinancing rule. The expression is derived by using the Lambert-W function to solve a tractable class of mortgage refinancing problems. We calibrate our solution and show that our quantitative results closely match those reported by researchers...