Estimate your monthly house payments quickly and accurately.
Please enter valid positive numbers for all fields.
Total Monthly Payment
$0.00
Principal & Interest$0.00
Tax & Insurance (Mo.)$0.00
Loan Amount$0.00
Total Interest Paid$0.00
How Mortgage Payments Are Calculated
Understanding how your monthly mortgage payment is derived is crucial for financial planning when purchasing a home. This calculator breaks down the costs into Principal, Interest, Taxes, and Insurance (often referred to as PITI).
The Mortgage Formula
The core principal and interest payment is calculated using the standard amortization formula:
M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1 ]
M = Total monthly payment
P = Principal loan amount (Home Price minus Down Payment)
i = Monthly interest rate (Annual Rate divided by 12)
n = Number of payments (Loan Term in years multiplied by 12)
Factors Affecting Your Payment
Several variables impact your final monthly cost:
Down Payment: A larger down payment reduces the principal loan amount, thereby lowering your monthly payments and total interest paid.
Interest Rate: Even a small difference in rates can significantly change the total cost of the loan over 30 years.
Loan Term: A 15-year term will have higher monthly payments than a 30-year term, but you will pay significantly less interest overall.
Escrow Costs: Property taxes and homeowners insurance are often collected monthly by the lender and held in an escrow account.
Example Calculation
For a home priced at $350,000 with a $70,000 (20%) down payment, you are borrowing $280,000. If you secure a 30-year fixed-rate mortgage at 6.5% interest:
Loan Amount: $280,000
Monthly Principal & Interest: Approximately $1,769.78
Total Interest Paid: Over $357,000 over the life of the loan.
This demonstrates why comparing rates and terms is essential for long-term savings.
function calculateMortgage() {
// 1. Get Input Values using var
var homePriceInput = document.getElementById("homePrice");
var downPaymentInput = document.getElementById("downPayment");
var interestRateInput = document.getElementById("interestRate");
var loanTermInput = document.getElementById("loanTerm");
var propertyTaxInput = document.getElementById("propertyTax");
var homeInsuranceInput = document.getElementById("homeInsurance");
var homePrice = parseFloat(homePriceInput.value);
var downPayment = parseFloat(downPaymentInput.value);
var interestRate = parseFloat(interestRateInput.value);
var loanTerm = parseFloat(loanTermInput.value);
var propertyTax = parseFloat(propertyTaxInput.value);
var homeInsurance = parseFloat(homeInsuranceInput.value);
// 2. Validation
var errorMsg = document.getElementById("errorMsg");
if (isNaN(homePrice) || isNaN(downPayment) || isNaN(interestRate) || isNaN(loanTerm) ||
homePrice <= 0 || loanTerm <= 0) {
errorMsg.style.display = "block";
document.getElementById("results").style.display = "none";
return;
} else {
errorMsg.style.display = "none";
}
// 3. Calculation Logic
var principal = homePrice – downPayment;
// Handle edge case where principal is 0 or less
if (principal <= 0) {
principal = 0;
}
var monthlyInterestRate = (interestRate / 100) / 12;
var numberOfPayments = loanTerm * 12;
var monthlyPrincipalInterest = 0;
// Formula: M = P[r(1+r)^n/((1+r)^n)-1)]
if (interestRate === 0) {
monthlyPrincipalInterest = principal / numberOfPayments;
} else {
var numerator = monthlyInterestRate * Math.pow((1 + monthlyInterestRate), numberOfPayments);
var denominator = Math.pow((1 + monthlyInterestRate), numberOfPayments) – 1;
monthlyPrincipalInterest = principal * (numerator / denominator);
}
var monthlyTax = propertyTax / 12;
var monthlyInsurance = homeInsurance / 12;
var totalMonthlyPayment = monthlyPrincipalInterest + monthlyTax + monthlyInsurance;
var totalInterest = (monthlyPrincipalInterest * numberOfPayments) – principal;
if (isNaN(totalInterest) || totalInterest < 0) totalInterest = 0;
// 4. Update DOM
document.getElementById("results").style.display = "block";
// Formatter for currency
var formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
minimumFractionDigits: 2
});
document.getElementById("totalMonthlyDisplay").innerHTML = formatter.format(totalMonthlyPayment);
document.getElementById("piDisplay").innerHTML = formatter.format(monthlyPrincipalInterest);
document.getElementById("taxInsDisplay").innerHTML = formatter.format(monthlyTax + monthlyInsurance);
document.getElementById("loanAmountDisplay").innerHTML = formatter.format(principal);
document.getElementById("totalInterestDisplay").innerHTML = formatter.format(totalInterest);
}