function calculateAffordability() {
// 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 loanTerm = parseFloat(document.getElementById("loanTerm").value);
var propertyTax = parseFloat(document.getElementById("propertyTax").value);
var homeInsurance = parseFloat(document.getElementById("homeInsurance").value);
// Validation
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(propertyTax)) propertyTax = 0;
if (isNaN(homeInsurance)) homeInsurance = 0;
// Logic: The 28/36 Rule
var monthlyGrossIncome = annualIncome / 12;
// Front-End Ratio Limit (28% of gross income for housing)
var frontEndLimit = monthlyGrossIncome * 0.28;
// Back-End Ratio Limit (36% of gross income minus other debts)
var backEndLimit = (monthlyGrossIncome * 0.36) – monthlyDebts;
// The lender will typically use the lower of the two limits
var maxAllowablePITI = Math.min(frontEndLimit, backEndLimit);
// If debts are too high, buying power might be zero
if (maxAllowablePITI 0) {
// Calculate Max Loan based on Max P&I
// Formula: PV = PMT * ( (1 – (1+r)^-n) / r )
var r = (interestRate / 100) / 12;
var n = loanTerm * 12;
// PV = P * [ ( (1+r)^n – 1 ) / ( r * (1+r)^n ) ]
maxLoan = maxPI * ( (Math.pow(1 + r, n) – 1) / (r * Math.pow(1 + r, n)) );
} else {
maxLoan = 0;
maxAllowablePITI = monthlyTax + monthlyIns; // Adjusted if they can't afford base costs
}
var maxPrice = maxLoan + downPayment;
// Update UI
document.getElementById("resultSection").style.display = "block";
document.getElementById("maxHomePrice").innerHTML = "$" + Math.floor(maxPrice).toLocaleString();
document.getElementById("maxMonthlyPayment").innerHTML = "$" + Math.floor(maxAllowablePITI).toLocaleString();
document.getElementById("maxLoanAmount").innerHTML = "$" + Math.floor(maxLoan).toLocaleString();
var ratioText = (frontEndLimit < backEndLimit) ? "28% (Front-End)" : "36% (Back-End)";
document.getElementById("dtiUsed").innerHTML = ratioText;
}
How Much House Can I Afford?
Determining your home buying budget is the most critical first step in the homeownership journey. This Mortgage Affordability Calculator uses standard lender guidelines to estimate the maximum home price you can afford based on your income, existing debts, and current interest rates.
Understanding the 28/36 Rule
Most financial lenders use the "28/36 Rule" to decide how much money they are willing to lend you. Understanding this rule is key to interpreting your results:
Front-End Ratio (28%): Your housing costs (mortgage 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, student loans, credit cards) should not exceed 36% of your gross monthly income.
Our calculator checks both ratios and limits your buying power to the lower (more conservative) figure, ensuring you don't overextend financially.
Key Factors That Impact Your Affordability
Several variables can drastically change your purchasing power:
Debt-to-Income (DTI) Ratio: High monthly debts (like a large car payment) reduce the amount of income available for a mortgage, lowering your maximum home price.
Interest Rates: Even a 1% increase in interest rates can reduce your buying power by tens of thousands of dollars because more of your monthly payment goes toward interest rather than principal.
Down Payment: A larger down payment increases your budget dollar-for-dollar and reduces the loan amount required, potentially lowering your monthly obligations.
Property Taxes & Insurance: These are "sunk costs" in your monthly payment. Areas with high property taxes will reduce the amount of mortgage loan you can support with your income.
How to Improve Your Home Buying Power
If the result isn't what you hoped for, consider these strategies to increase your affordability:
1. Pay Down Debt: Reducing monthly recurring debts is the fastest way to improve your back-end ratio.
2. Save for a Larger Down Payment: This reduces the loan size and may help you avoid Private Mortgage Insurance (PMI).
3. Improve Your Credit Score: Better credit often qualifies you for lower interest rates, which significantly boosts how much house you can buy for the same monthly payment.