Understanding how much house you can afford is a crucial first step in the home-buying process. This mortgage affordability calculator helps you estimate your potential borrowing power based on your income, debts, and desired loan terms. By inputting your financial details, you can get a clearer picture of the price range you should be looking at, enabling you to make informed decisions and avoid overextending your budget.
The calculator considers several key factors: your gross monthly income (the total income before taxes and deductions), your existing monthly debt payments (such as car loans, student loans, and credit card minimums), the estimated mortgage interest rate, and the loan term (the number of years you plan to repay the mortgage). It also factors in potential property taxes and homeowners insurance, which are often included in your monthly mortgage payment (known as PITI – Principal, Interest, Taxes, and Insurance).
Generally, lenders prefer your total monthly housing expenses (PITI) not to exceed 28% of your gross monthly income (the "front-end ratio") and your total debt obligations (including housing) not to exceed 36% of your gross monthly income (the "back-end ratio"). This calculator uses these common guidelines to provide an estimated affordable home price. Remember, this is an estimate, and your actual borrowing capacity may vary based on the specific lender, your credit score, down payment, and other financial circumstances.
function calculateAffordability() {
var grossMonthlyIncome = parseFloat(document.getElementById("grossMonthlyIncome").value);
var monthlyDebtPayments = parseFloat(document.getElementById("monthlyDebtPayments").value);
var interestRate = parseFloat(document.getElementById("interestRate").value);
var loanTermYears = parseFloat(document.getElementById("loanTermYears").value);
var downPaymentPercentage = parseFloat(document.getElementById("downPaymentPercentage").value);
var propertyTaxesAnnual = parseFloat(document.getElementById("propertyTaxesAnnual").value);
var homeInsuranceAnnual = parseFloat(document.getElementById("homeInsuranceAnnual").value);
var maxHousingPaymentRatio = 0.28; // Front-end ratio
var maxTotalDebtRatio = 0.36; // Back-end ratio
var resultElement = document.getElementById("result");
resultElement.innerHTML = ""; // Clear previous results
if (isNaN(grossMonthlyIncome) || isNaN(monthlyDebtPayments) || isNaN(interestRate) || isNaN(loanTermYears) || isNaN(downPaymentPercentage) || isNaN(propertyTaxesAnnual) || isNaN(homeInsuranceAnnual)) {
resultElement.innerHTML = "Please enter valid numbers for all fields.";
return;
}
var maxAffordableHousingPayment = grossMonthlyIncome * maxHousingPaymentRatio;
var maxTotalMonthlyObligation = grossMonthlyIncome * maxTotalDebtRatio;
var allowedMortgagePayment = maxTotalMonthlyObligation – monthlyDebtPayments;
// Use the lower of the two calculated maximums for the actual mortgage payment
var actualMaxMortgagePayment = Math.min(maxAffordableHousingPayment, allowedMortgagePayment);
if (actualMaxMortgagePayment <= 0) {
resultElement.innerHTML = "Based on your income and debts, your maximum affordable monthly mortgage payment is too low to estimate a home price. Please adjust your inputs or consider increasing your income/reducing debts.";
return;
}
var monthlyPropertyTaxes = propertyTaxesAnnual / 12;
var monthlyHomeInsurance = homeInsuranceAnnual / 12;
var totalMonthlyPITI = actualMaxMortgagePayment;
var monthlyPrincipalInterest = totalMonthlyPITI – monthlyPropertyTaxes – monthlyHomeInsurance;
if (monthlyPrincipalInterest 0) {
maxLoanAmount = monthlyPrincipalInterest * (Math.pow(1 + monthlyInterestRate, loanTermMonths) – 1) / (monthlyInterestRate * Math.pow(1 + monthlyInterestRate, loanTermMonths));
} else {
// Handle zero interest rate scenario (though unlikely for mortgages)
maxLoanAmount = monthlyPrincipalInterest * loanTermMonths;
}
var downPaymentAmount = maxLoanAmount * (downPaymentPercentage / 100);
var estimatedMaxHomePrice = maxLoanAmount + (maxLoanAmount * (downPaymentPercentage / 100));
resultElement.innerHTML =
"
Estimated Affordability Results:
" +
"Maximum Affordable Monthly PITI (Principal, Interest, Taxes, Insurance): $" + actualMaxMortgagePayment.toFixed(2) + "" +
"Estimated Maximum Loan Amount: $" + maxLoanAmount.toFixed(2) + "" +
"Estimated Maximum Home Price (with " + downPaymentPercentage + "% down payment): $" + estimatedMaxHomePrice.toFixed(2) + "" +
"Note: This is an estimate. Actual affordability may vary based on lender, credit score, and other factors.";
}