Use this calculator to estimate how much home you can afford based on your income, debts, and desired mortgage terms. Understanding your mortgage affordability is a crucial first step in the home-buying process.
Understanding Mortgage Affordability
Determining how much mortgage you can afford involves several key factors. Lenders typically look at your Debt-to-Income (DTI) ratio, which compares your total monthly debt payments to your gross monthly income. A common guideline is that your total housing costs (principal, interest, property taxes, and insurance – often called PITI) should not exceed 28% of your gross monthly income, and your total debt (including PITI) should not exceed 36%.
This calculator provides an estimate based on these principles. It considers:
Annual Gross Income: Your total income before taxes.
Monthly Debt Payments: Existing loans, credit card minimums, etc. (excluding the potential mortgage payment).
Down Payment: The upfront cash you contribute towards the home's purchase price.
Interest Rate: The annual percentage rate you'd pay on the mortgage.
Loan Term: The number of years you'll take to repay the mortgage.
Property Taxes: Annual taxes on the property, which vary by location.
Homeowners Insurance: The cost of insuring your home against damage.
The output will give you an estimated maximum affordable home price and the corresponding maximum mortgage amount you might qualify for. Remember, this is an estimate, and actual loan approval depends on the lender's specific criteria, your credit score, employment history, and other financial details.
function calculateMortgageAffordability() {
var annualIncome = parseFloat(document.getElementById("annualIncome").value);
var monthlyDebt = parseFloat(document.getElementById("monthlyDebt").value);
var downPayment = parseFloat(document.getElementById("downPayment").value);
var interestRate = parseFloat(document.getElementById("interestRate").value);
var loanTerm = parseFloat(document.getElementById("loanTerm").value);
var propertyTaxRate = parseFloat(document.getElementById("propertyTaxRate").value);
var homeownersInsurance = parseFloat(document.getElementById("homeownersInsurance").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
if (isNaN(annualIncome) || isNaN(monthlyDebt) || isNaN(downPayment) || isNaN(interestRate) || isNaN(loanTerm) || isNaN(propertyTaxRate) || isNaN(homeownersInsurance)) {
resultDiv.innerHTML = "Please enter valid numbers for all fields.";
return;
}
var grossMonthlyIncome = annualIncome / 12;
var maxMonthlyHousingPayment = grossMonthlyIncome * 0.28; // 28% rule for housing costs
var maxTotalDebtPayment = grossMonthlyIncome * 0.36; // 36% rule for total debt
// Calculate maximum allowed mortgage payment (P&I only)
var maxMonthlyMortgagePrincipalInterest = maxTotalDebtPayment – monthlyDebt;
// Ensure monthly mortgage payment doesn't exceed the 28% rule
if (maxMonthlyMortgagePrincipalInterest > maxMonthlyHousingPayment) {
maxMonthlyMortgagePrincipalInterest = maxMonthlyHousingPayment;
}
// Calculate the maximum loan amount based on the maximum monthly P&I payment
var monthlyInterestRate = interestRate / 100 / 12;
var numberOfPayments = loanTerm * 12;
var maxLoanAmount = 0;
if (monthlyInterestRate > 0) {
maxLoanAmount = maxMonthlyMortgagePrincipalInterest * (1 – Math.pow(1 + monthlyInterestRate, -numberOfPayments)) / monthlyInterestRate;
} else {
// Handle zero interest rate case
if (numberOfPayments > 0) {
maxLoanAmount = maxMonthlyMortgagePrincipalInterest * numberOfPayments;
}
}
// Calculate estimated annual property taxes and monthly property taxes
var estimatedAnnualPropertyTax = maxLoanAmount * (propertyTaxRate / 100); // Based on estimated loan amount, a more precise calculation would use home price
var monthlyPropertyTax = estimatedAnnualPropertyTax / 12;
// Calculate total estimated monthly PITI
var totalMonthlyPITI = maxMonthlyMortgagePrincipalInterest + monthlyPropertyTax + (homeownersInsurance / 12);
// Adjust maxLoanAmount if the calculated PITI exceeds the 28% rule due to taxes/insurance
// This is an iterative refinement, but for simplicity, we'll assume the initial 28% for P&I is the driver.
// A more complex calculator might iterate to find the exact loan amount where PITI = 28% and total debt = 36%.
var estimatedMaxHomePrice = maxLoanAmount + downPayment;
resultDiv.innerHTML =
"