Your estimated monthly mortgage payment will be: $0.00
Understanding Your Mortgage Payment
A mortgage is a type of loan used to purchase real estate, where the property itself serves as collateral for the loan. The monthly mortgage payment typically consists of several components, often referred to as PITI: Principal, Interest, Taxes, and Insurance. However, this calculator focuses on the core of your payment: the Principal and Interest (P&I).
Principal and Interest (P&I) Calculation
The formula used to calculate the Principal and Interest portion of your monthly mortgage payment is derived from the standard annuity payment formula:
M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1]
Where:
M = Your total monthly mortgage payment (Principal & Interest)
P = The principal loan amount (the amount you borrowed)
i = Your monthly interest rate (annual rate divided by 12)
n = The total number of payments over the loan's lifetime (loan term in years multiplied by 12)
How the Calculator Works
1. Loan Amount (P): This is the total sum of money you are borrowing to buy your home.
2. Annual Interest Rate: This is the yearly rate of interest charged on the loan. The calculator converts this to a monthly rate by dividing by 12.
3. Loan Term (Years): This is the duration of the loan, typically 15, 30, or even 50 years. The calculator converts this to the total number of monthly payments.
By inputting these figures, the calculator applies the formula to determine your fixed monthly P&I payment.
Important Considerations:
Taxes and Insurance (T&I): This calculator does NOT include property taxes or homeowner's insurance, which are typically included in your actual monthly mortgage payment and paid into an escrow account.
Private Mortgage Insurance (PMI): If your down payment is less than 20%, you may also have to pay PMI, which is not included here.
HOA Dues: Homeowners Association fees are also separate and not included.
Adjustable Rates: This calculation assumes a fixed-rate mortgage. Adjustable-rate mortgages (ARMs) will have payments that can change over time.
Use this calculator as a starting point to estimate your core mortgage costs.
function calculateMortgage() {
var loanAmount = parseFloat(document.getElementById("loanAmount").value);
var annualInterestRate = parseFloat(document.getElementById("annualInterestRate").value);
var loanTermYears = parseInt(document.getElementById("loanTermYears").value);
var resultDisplay = document.getElementById("mortgage-result");
if (isNaN(loanAmount) || isNaN(annualInterestRate) || isNaN(loanTermYears) || loanAmount <= 0 || annualInterestRate < 0 || loanTermYears <= 0) {
resultDisplay.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
var monthlyInterestRate = (annualInterestRate / 100) / 12;
var numberOfPayments = loanTermYears * 12;
var monthlyPayment;
if (monthlyInterestRate > 0) {
var numerator = monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments);
var denominator = Math.pow(1 + monthlyInterestRate, numberOfPayments) – 1;
monthlyPayment = loanAmount * (numerator / denominator);
} else {
// Handle case where interest rate is 0%
monthlyPayment = loanAmount / numberOfPayments;
}
// Format the monthly payment to two decimal places
var formattedMonthlyPayment = monthlyPayment.toFixed(2);
resultDisplay.innerHTML = "Your estimated monthly mortgage payment will be: $" + formattedMonthlyPayment + "";
}