For years I put off thinking about refinancing our house. I just didn’t want to deal with all the factors I would have to consider, even though our 30 year mortgage rate wasn’t that great (4.75%).

Then I started seeing some news articles about mortgage rates hitting all time lows. Gritting my teeth, I finally forced myself to buckle down and take a careful look.

A major factor behind my procrastination: I couldn’t find calculators or content online that took into account average investment returns when comparing refinance scenarios. Everything I found online and in books had an incomplete approach: calculating when the savings from the lower mortgage rate would equal the cost of the refinance. Then you determine if you think you’ll live in the property longer than that to determine if the refinance is worth it.

On the surface that approach seems reasonable, but it completely ignores something critical: investment returns. What if you took the money that you would spend on the various fees of a refinance and invested it in a low cost total stock market index fund like Vanguard’s VTSAX? That would be the opportunity cost of the refinance fees. And what if you invested the extra cash you get each month with a lower monthly payment from the refinance? That’s the opportunity cost of NOT doing the refinance. And what about the extra money you would have once you pay off your current mortgage, versus a refinanced mortgage where the required payments would continue for years after the original mortgage would have ended?

So when I’m confronted with a tough financial decision, I break out Python! You can download my python script here, which has some example values to get you started. Hopefully one day I’ll learn how to make a web application that can run this code and provide the results (and/or get some help from friends), but until then you can take a look at the python script to see what I did and run it yourself if desired. If you see a mistake in my math/code, please let me know!

The end goal of writing this python script: reveal which scenario results in the highest liquid asset value after 30 years (so not including house equity, which doesn’t pay the bills), so that we can decide whether to refinance and what refinance options we should choose.

**Inputs**

There are a number of inputs required in my python script (with our numbers used as representative values):

**Initial liquid balance**: $200K (Any value is fine here, I just chose a value high enough to keep it positive throughout the mortgage period. In terms of deciding between options, you could set this to $0 and simply look at which option costs you the least over 30 years.)

**Current Mortgage Rate**: 4.75%

**Remaining Number Of Months On Current Loan**: 11+(2043-2020)*12 (11 months plus all years through 2043)

**New Loan Amount (i.e. current mortgage balance)** = $169,455.74

**New Interest Rate** = 3.875% (one example I found online – from back when I did this analysis, now the rates are much lower)

**Total Refinance Cost** $4,618.56 (= 235 + 480 + 0.01*169455.74 + 255 + 275 + 750 + 733 + 138 + 58, from this ValuePenguin site, or we could just use the top average they provide: $4,345)

**Number of months on new loan**: 360 (30 year mortgage)

**Assumed rate of return for investments in index funds**: 7% (critical assumption! 7% is a common moderately conservative assumed long-term annual average return for the stock market, but you can use a more or less conservative value as desired)

**Calculating Monthly Payment**

Your monthly payment is a function of three variables: loan amount, loan duration, and interest rate.

P = L * ( r*(1+r)^n ) / ( (1+r)^n – 1)

where P is your monthly payment, L is the loan amount, r is the monthly interest rate (= annual interest rate / 12, which is not actually correct, but every source I find says this, and it appears that is the formulation used by every financial entity I’ve worked with), and n is the number of payments (= number of years * 12).

Once you calculate this monthly payment, then you can simulate the month-to-month liquid balance over time for any scenario you wish.

**Results**

**30 Year Refinance**

First we consider how our liquid balance changes over time for two scenarios: keeping our current mortgage versus doing the refinance.

You can see how the refinance plot starts lower than the “no refi” plot due to the refinance expenses. But then the refinance scenario pretty rapidly overtakes the “no refi” scenario and after 30 years it is $108K ahead. So we’ll gain $108K over the next 30 years by refinancing! (And of course that is with an average annual stock market return of 7%.)

To better see the difference between the refinance scenario and the “no refi” scenario, I also plot the refi values minus the “no refi” values:

You can see how the “break-even point”, where you start to save money, is about 2 years (2.17 years to be exact). Assuming you are going to be in your house (or at least renting it) past the break-even point, the refinance is a slam dunk.

Something that really strikes me as neat: the difference in the performance of those scenarios is not affected by the initial liquid balance: I just chose a value that made the plots easier to see. If I use $100K or $0K instead of $200K, the plot of the difference in liquid balance over time is the same.

Note the kink in the “no refi” scenario at year 24: that is when the original mortgage would be paid off, and thus we would be investing those funds instead of making mortgage payments. But even though the difference plot goes down for the final 6 years, the end result after 30 years (when all mortgages would be paid off) shows a significant improvement in your final liquid balance by refinancing.

**If You Don’t Include Investment Returns**

What if you don’t include the 7% assumed investment return? If we change the assumed investment from 7% to 0%:

Wow, what a difference! While the break even point is slightly sooner (2.08 years), the end result is you actually LOSE $7.63K because of those final 6 years when the original mortgage is paid off. Incredible.

There are certainly scenarios where you’ll still save money by refinancing even with 0% investment returns, but it’s amazing to me that you can construct a scenario like this at all – a $7K loss over 30 years instead of a $108K gain! All because the investment returns are neglected, which every refinance calculator I have found online does!

**15 Year Mortgage Refinance**

What about 15 year mortgages? Those have even lower interest rates than 30 year mortgages, so those should be even better, right? Unfortunately, no:

The above scenario assumes the same closing costs and a 3.2% interest rate for the 15 year mortgage (vs 3.875% for the 30 year mortgage), with the assumed 7% investment return turned back on. You can see how the 15 year refinance option only ends up $8.18K above the no-refinance option. And ~$100K lower than the 30 year finance option!

The “problem” with 15 year mortgages is that despite the lower interest rate, you are forced to pay off the loan in half the time versus a 30 year mortgage, and thus your monthly payments are significantly higher. Thus you lose the ability to invest that money.

But of course if you prefer the certainty of having a paid off house over uncertain investment returns, the 15 year mortgage can be a great compromise between immediately paying off your house and having a mortgage for 30 years (especially with the even lower interest rates provided).

**Cash-Out Refinance**

On the other end of the risk/return spectrum is the cash-out refinance, where you pull as much equity out of your house as you can (typically 80% of your house value, so you can have a standard conforming mortgage with no mortgage insurance). As a result, your mortgage payments will be much higher (assuming you’ve pulled an appreciable amount of equity out of the house), but you’ll be able to invest all that equity you extracted. That investment will likely provide higher returns than you’ll pay in interest on the higher loan value.

If we assume the same refinance costs, the same 30 year interest rate (3.875%) and assumed investment return (7%), and a loan value of 0.8*$350K = $280K (so pulling $280,000 – $169,455.74 = $110,544.26 in equity out of your house):

You can see how after 30 years, the cash-out refinance ends up $367.52K above the no-refinance, and $367.52K – $108.15K = $259.37K ahead of the standard refinance (a new 30 year loan for the current mortgage balance)! A good chunk of change!

We strongly considered doing a cash-out refinance, as our scenario roughly matched the above numbers. We’re talking hundreds of thousands of dollars after all. But we decided to go the more conservative route with a traditional refinance as a hedge against poor market performance. Especially given how expensive stocks are currently. Thus just like the 15 year mortgage can be a nice middle ground option between fully paying off your house and 30 year mortgage, we chose the middle ground option of refinancing our current loan balance instead of a cash-out refinance. It all comes down to your risk tolerance in the end: do what you’re most comfortable with.

**What We Did**

So my wife and I reached out to the company SoFi, which has been one of the leaders in the online-only lender space, providing lower rates due to lower overhead. After talking with one of their loan officers, we chose to go with the standard 30 year mortgage refinance. The lowest rate without buying “discount points” (to reduce the rate) was 3.625% for the 30 year mortgage, and the refinance cost for this option was approximately $3906. The results of doing the refinance with those numbers:

By refinancing, we would end up **$143.42K** wealthier after 30 years (assuming 7% investment returns), with a break-even point of 1.67 years. Even better results than the generic scenario shown above, primarily due to the better interest rate.

#### Buying Down Our Rate

However, we decided that since we plan to be in our house for a good number of years and that mortgage rates are not likely to dive substantially lower than they currently are, we would “buy down” the rate using something called “discount points”. We decided to buy down the rate as low as possible, paying $4487.19 (2.648% of the loan amount) to get it down to 3.125%. I found out later that we could have paid over $1K less for buying down to this rate from Agora lending, but we were pretty deep into the process with SoFi (including having already done a hard credit pull), so we decided to stick with SoFi. We were also not sure about the reliability of Agora, as they seemed much flakier in our initial communication with them. If you’ve had good/bad experiences with Agora, I’d love to hear about it. Anyways, the result of buying down the rate:

Buying down the rate results in **$164.55K** more money after 30 years, with a break-even point of 3 years. So the break-even point is later than not buying down the rate (3 years instead of 1.67 years), but we end up $20K richer over 30 years – worth it to us. The reason it ends up on top is that the savings from the lower rate over time dominates the additional initial cost.

#### Wrapping Closing Costs Into Loan

Talking with SoFi, I also learned we could wrap nearly all of these closing costs into the loan! So I wondered if that was worth it and thus ran a new simulation: I changed the new loan amount to $169455.74 + $3906 + $4713.44 – $525 (the appraisal fee we can’t wrap into the loan) = $177550.18, and the refinance cost to $525 (the appraisal fee). Note the cost to pay down the rate increases slightly from $4487.19 to $4713.44, since the loan is now slightly larger.

You can see how wrapping those closing costs into the loan produces savings of **$185.87K** over 30 years vs not refinancing! Nearly $200K! And $185.87K – $164.55K = $21.32K higher than not wrapping the closing costs into the loan. And now the break-even point is only 3 months! Incredible. Rolling those closing costs into the loan is better than not rolling them in for the same reason it’s better to have a long-term low interest rate mortgage than to pay off your house in full: you are able to invest those funds and thus likely get a much higher rate of return than you will pay in interest over the life of the loan.

**Conclusions**

So in the end we expect to save approximately **$185.87K** over the next 30 years by refinancing, assuming average market returns during that time span. More than the current amount we owe on the house!

In general, to have the most money after 30 years, you want the lowest interest rate you can get (even if it means buying down the rate), for the most money you can get, with a payment period as long as possible. Thus theoretically you’d be best off doing a cash-out refinance for as much money as the lender will do, and with an interest-only loan that never ends! Though in reality, from my limited research it appears that interest-only loans are still not indefinite (e.g. it’s only interest-only for the first 5 years of a 30 year loan), and they also usually have higher rates, which likely negates the advantage of paying interest only during that early time frame. That interest really drives your results over multiple decades.

One quick way to assess different options when looking at rates online is to compare the APR value of each option, which incorporates both the base interest rate and the associated closing costs of the loan. In general you want the lowest APR available for maximum savings over 30 years.

Another option I considered: Home Equity Lines of Credit (HELOC). These loans allow you to extract equity from your house without doing a full cash-out mortgage refinance, but from my limited research it appears the rates are higher than standard conforming mortgage rates (though still reasonable as compared to personal loans, etc.). And if you have an unsatisfactory rate on your current mortgage, a HELOC will not fix that. Thus we decided to not pursue a HELOC right now, but we may consider it in the future, especially if we see really low rates. If you happen to know where to find the lowest HELOC rates, please feel free to leave a comment or shoot me a note and I’ll add that to the post.

We took a more middle road in the end, and we are satisfied with the route we chose (especially as compared to our previous high 4.75% interest rate mortgage). If you have any questions / feedback / comments, please feel free to comment below or shoot me a note.

*Note: This post was originally on a different site and some of the comments below are from that original post (thus the older comment dates). *

Rob OlsonVery impressive analysis. Thanks!

Travis McCartyIt would be interesting to run a Monte Carlo simulation to see the impact of sequence of return risk.

EngineeringYourFIGreat idea! I’ll add that to my list, that would be a great addition to the article.