Determining your budget is the first and most critical step in the home buying process. This Mortgage Affordability Calculator uses the standard debt-to-income (DTI) ratios used by lenders to estimate your purchasing power.
Understanding the 28/36 Rule
Most financial advisors and mortgage lenders adhere to the 28/36 rule to determine affordability:
Front-End Ratio (28%): Your monthly housing costs (principal, interest, taxes, and insurance) should not exceed 28% of your gross monthly income.
Back-End Ratio (36%): Your total monthly debt payments (housing costs + car loans, credit cards, student loans) should not exceed 36% of your gross monthly income.
This calculator determines the maximum monthly payment allowed under both rules and uses the lower (more conservative) number to calculate your home price limit.
Factors Affecting Your Affordability
Several key variables impact how much home you can buy:
Income: Higher gross income increases your borrowing capacity.
Existing Debt: High monthly debt obligations reduce the amount of income available for a mortgage. Eliminating car payments or credit card debt can significantly boost your home budget.
Interest Rates: Even a small increase in interest rates can reduce your buying power by thousands of dollars because more of your monthly payment goes toward interest rather than principal.
Down Payment: A larger down payment reduces the loan amount required, allowing you to purchase a more expensive home for the same monthly payment.
Why Include Taxes and Insurance?
Your mortgage payment isn't just for the loan itself. Lenders look at PITI (Principal, Interest, Taxes, and Insurance). In areas with high property taxes, your purchasing power may be lower because a significant portion of your monthly budget must cover these costs.
function calculateAffordability() {
// 1. Get Input Values
var annualIncome = parseFloat(document.getElementById("annualIncome").value);
var monthlyDebts = parseFloat(document.getElementById("monthlyDebts").value);
var downPayment = parseFloat(document.getElementById("downPayment").value);
var interestRate = parseFloat(document.getElementById("interestRate").value);
var loanTermYears = parseFloat(document.getElementById("loanTerm").value);
var monthlyTaxIns = parseFloat(document.getElementById("monthlyTaxIns").value);
// 2. Validate Inputs
if (isNaN(annualIncome) || annualIncome <= 0) {
alert("Please enter a valid Annual Income.");
return;
}
if (isNaN(monthlyDebts)) monthlyDebts = 0;
if (isNaN(downPayment)) downPayment = 0;
if (isNaN(interestRate) || interestRate <= 0) {
alert("Please enter a valid Interest Rate.");
return;
}
if (isNaN(loanTermYears) || loanTermYears <= 0) {
alert("Please enter a valid Loan Term.");
return;
}
if (isNaN(monthlyTaxIns)) monthlyTaxIns = 0;
// 3. Perform Calculations
var monthlyGrossIncome = annualIncome / 12;
// Rule 1: Front-End Ratio (Housing costs <= 28% of income)
var maxHousingFrontEnd = monthlyGrossIncome * 0.28;
// Rule 2: Back-End Ratio (Total debt <= 36% of income)
var maxTotalDebt = monthlyGrossIncome * 0.36;
var maxHousingBackEnd = maxTotalDebt – monthlyDebts;
// Determine the limiting factor (the lower of the two)
var maxAllowedHousingPayment = Math.min(maxHousingFrontEnd, maxHousingBackEnd);
// Determine which rule was the limiting factor for display purposes
var limitingRule = (maxHousingFrontEnd < maxHousingBackEnd) ? "Front-End (28%)" : "Back-End (36%)";
// If debts are too high, affordability might be zero or negative
if (maxAllowedHousingPayment <= monthlyTaxIns) {
document.getElementById("results").style.display = "block";
document.getElementById("resMaxHomePrice").innerHTML = "$0.00";
document.getElementById("resTotalMonthly").innerHTML = "$0.00";
document.getElementById("resPrincipalInterest").innerHTML = "$0.00";
document.getElementById("resDtiUsed").innerHTML = "Debt too high";
return;
}
// Available for Principal & Interest (P&I)
var availableForPI = maxAllowedHousingPayment – monthlyTaxIns;
// Mortgage Calculation Formula: P = (M * (1 – (1 + r)^-n)) / r
// r = monthly interest rate (annual / 12 / 100)
// n = total number of payments (years * 12)
var r = interestRate / 100 / 12;
var n = loanTermYears * 12;
var maxLoanAmount = (availableForPI * (1 – Math.pow(1 + r, -n))) / r;
var maxHomePrice = maxLoanAmount + downPayment;
// 4. Formatting Output
var currencyFormatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
minimumFractionDigits: 0,
maximumFractionDigits: 0
});
var monthlyFormatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
minimumFractionDigits: 2,
maximumFractionDigits: 2
});
// 5. Display Results
document.getElementById("results").style.display = "block";
document.getElementById("resMaxHomePrice").innerHTML = currencyFormatter.format(maxHomePrice);
document.getElementById("resTotalMonthly").innerHTML = monthlyFormatter.format(maxAllowedHousingPayment);
document.getElementById("resPrincipalInterest").innerHTML = monthlyFormatter.format(availableForPI);
document.getElementById("resDtiUsed").innerHTML = limitingRule;
}