Mortgage Comparison Calculator Formula
Understand the math behind the mortgage comparison calculator. Each variable explained with a worked example.
Formulas Used
Loan A Monthly Payment
payment_a = pmt_aLoan B Monthly Payment
payment_b = pmt_bMonthly Payment Difference
payment_diff = abs(pmt_a - pmt_b)Loan A Total Interest
total_interest_a = pmt_a * na - loan_amount_aLoan B Total Interest
total_interest_b = pmt_b * nb - loan_amount_bInterest Savings (lower total)
interest_savings = abs((pmt_a * na - loan_amount_a) - (pmt_b * nb - loan_amount_b))Variables
| Variable | Description | Default |
|---|---|---|
loan_amount_a | Loan A Amount(USD) | 350000 |
rate_a | Loan A Interest Rate(%) | 6.5 |
term_a | Loan A Term(years) | 30 |
loan_amount_b | Loan B Amount(USD) | 350000 |
rate_b | Loan B Interest Rate(%) | 6 |
term_b | Loan B Term(years) | 15 |
ra | Derived value= rate_a / 100 / 12 | calculated |
na | Derived value= term_a * 12 | calculated |
pmt_a | Derived value= ra > 0 ? loan_amount_a * ra * pow(1 + ra, na) / (pow(1 + ra, na) - 1) : loan_amount_a / na | calculated |
rb | Derived value= rate_b / 100 / 12 | calculated |
nb | Derived value= term_b * 12 | calculated |
pmt_b | Derived value= rb > 0 ? loan_amount_b * rb * pow(1 + rb, nb) / (pow(1 + rb, nb) - 1) : loan_amount_b / nb | calculated |
How It Works
Comparing Mortgage Options
Comparing mortgages requires looking beyond the monthly payment to understand total cost over the loan life.
Key Comparison Factors
Common Comparisons
Decision Framework
Choose the lower payment if cash flow is tight or you can invest the difference at a return exceeding the rate savings. Choose the lower total cost if you plan to hold the loan to maturity.
Worked Example
Comparing a $350,000 loan at 6.5% for 30 years vs 6.0% for 15 years.
loan_amount_a = 350000rate_a = 6.5term_a = 30loan_amount_b = 350000rate_b = 6term_b = 15
- 01Loan A (30yr at 6.5%): $2,212.24/month
- 02Loan B (15yr at 6.0%): $2,953.98/month
- 03Monthly difference: $2,953.98 - $2,212.24 = $741.74
- 04Loan A total interest: $2,212.24 x 360 - $350,000 = $446,406
- 05Loan B total interest: $2,953.98 x 180 - $350,000 = $181,716
- 06Interest savings with Loan B: $446,406 - $181,716 = $264,690
Ready to run the numbers?
Open Mortgage Comparison Calculator