Estimate your monthly mortgage payments based on the home price, down payment, interest rate, and loan term.
Please enter valid positive numbers for all fields.
Monthly Payment: $0.00
Loan Amount:$0.00
Total Interest Paid:$0.00
Total Cost of Loan:$0.00
Payoff Date:–
How to Calculate Your Monthly Mortgage Payment
Understanding your monthly mortgage payment is the first step toward homeownership. This calculator uses the standard amortization formula to determine exactly how much principal and interest you will pay each month based on your loan parameters.
The calculation is based on four key factors:
Home Price: The total purchase price of the property.
Down Payment: The upfront cash you pay toward the home. A larger down payment reduces the loan amount and often secures a lower interest rate.
Interest Rate: The annual percentage rate charged by the lender. Even a small difference in rates can significantly impact your total cost over 30 years.
Loan Term: The duration of the loan, typically 15 or 30 years. Shorter terms have higher monthly payments but lower total interest costs.
The Mortgage Formula Explained
While this calculator handles the math instantly, it helps to understand the underlying formula used by lenders:
M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1]
Where:
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 months (Loan Term in years multiplied by 12)
How Interest Rates Affect Buying Power
Interest rates are dynamic and change based on economic conditions and your credit score. For example, on a $300,000 loan, the difference between a 6% and a 7% interest rate is approximately $200 per month. Over the life of a 30-year loan, that 1% difference costs you an extra $72,000.
Principal vs. Interest
In the early years of your mortgage, the majority of your payment goes toward interest, with only a small portion reducing your principal balance. As time passes, this ratio flips, and you begin paying down the debt more rapidly. This process is known as amortization.
function calculateMortgage() {
// 1. Get Input Values
var homePrice = parseFloat(document.getElementById('mc-home-price').value);
var downPayment = parseFloat(document.getElementById('mc-down-payment').value);
var interestRate = parseFloat(document.getElementById('mc-interest-rate').value);
var loanTermYears = parseFloat(document.getElementById('mc-loan-term').value);
var errorDiv = document.getElementById('mc-error');
var resultsDiv = document.getElementById('mc-results');
// 2. Validate Inputs
if (isNaN(homePrice) || isNaN(downPayment) || isNaN(interestRate) || isNaN(loanTermYears) ||
homePrice <= 0 || loanTermYears <= 0) {
errorDiv.style.display = 'block';
resultsDiv.style.display = 'none';
return;
} else {
errorDiv.style.display = 'none';
}
// 3. Perform Calculations
var principal = homePrice – downPayment;
// Handle edge case where principal is 0 or negative
if (principal <= 0) {
document.getElementById('mc-monthly-payment').innerHTML = "$0.00";
document.getElementById('mc-loan-amount').innerHTML = "$0.00";
document.getElementById('mc-total-interest').innerHTML = "$0.00";
document.getElementById('mc-total-cost').innerHTML = "$0.00";
document.getElementById('mc-payoff-date').innerHTML = "-";
resultsDiv.style.display = 'block';
return;
}
var monthlyInterestRate = (interestRate / 100) / 12;
var numberOfPayments = loanTermYears * 12;
var monthlyPayment = 0;
// Handle zero interest rate
if (interestRate === 0) {
monthlyPayment = principal / numberOfPayments;
} else {
// Standard Amortization Formula
// M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1]
var x = Math.pow(1 + monthlyInterestRate, numberOfPayments);
monthlyPayment = (principal * x * monthlyInterestRate) / (x – 1);
}
var totalPaymentAmount = monthlyPayment * numberOfPayments;
var totalInterest = totalPaymentAmount – principal;
// Calculate Payoff Date
var today = new Date();
var payoffDate = new Date(today.setMonth(today.getMonth() + numberOfPayments));
var options = { year: 'numeric', month: 'long' };
var payoffDateString = payoffDate.toLocaleDateString('en-US', options);
// 4. Update UI
// Helper function for currency formatting
var formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
minimumFractionDigits: 2
});
document.getElementById('mc-monthly-payment').innerHTML = formatter.format(monthlyPayment);
document.getElementById('mc-loan-amount').innerHTML = formatter.format(principal);
document.getElementById('mc-total-interest').innerHTML = formatter.format(totalInterest);
document.getElementById('mc-total-cost').innerHTML = formatter.format(totalPaymentAmount);
document.getElementById('mc-payoff-date').innerHTML = payoffDateString;
// Show results
resultsDiv.style.display = 'block';
}