function calculateAffordability() {
var annualIncome = parseFloat(document.getElementById('annualIncome').value);
var monthlyDebts = parseFloat(document.getElementById('monthlyDebts').value);
var downPayment = parseFloat(document.getElementById('downPayment').value);
var annualRate = parseFloat(document.getElementById('interestRate').value);
var years = parseFloat(document.getElementById('loanTerm').value);
var dtiLimit = parseFloat(document.getElementById('dtiRatio').value) / 100;
if (isNaN(annualIncome) || isNaN(annualRate) || annualIncome <= 0) {
alert("Please enter valid financial information.");
return;
}
var monthlyGrossIncome = annualIncome / 12;
var maxAllowedMonthlyPayment = (monthlyGrossIncome * dtiLimit) – monthlyDebts;
if (maxAllowedMonthlyPayment <= 0) {
document.getElementById('affordResult').style.display = 'block';
document.getElementById('maxHomePrice').innerHTML = "Ineligible";
document.getElementById('maxMonthlyPITI').innerHTML = "$0";
document.getElementById('totalLoan').innerHTML = "$0";
return;
}
var monthlyRate = annualRate / 100 / 12;
var totalMonths = years * 12;
// Formula: P = L * [c(1 + c)^n] / [(1 + c)^n – 1]
// Rearranged for Loan Amount (L): L = P * [ (1 + c)^n – 1 ] / [ c(1 + c)^n ]
var loanAmount = maxAllowedMonthlyPayment * (Math.pow(1 + monthlyRate, totalMonths) – 1) / (monthlyRate * Math.pow(1 + monthlyRate, totalMonths));
var maxHomePrice = loanAmount + downPayment;
document.getElementById('affordResult').style.display = 'block';
document.getElementById('maxHomePrice').innerHTML = "$" + Math.round(maxHomePrice).toLocaleString();
document.getElementById('maxMonthlyPITI').innerHTML = "$" + Math.round(maxAllowedMonthlyPayment).toLocaleString();
document.getElementById('totalLoan').innerHTML = "$" + Math.round(loanAmount).toLocaleString();
}
How Much House Can You Actually Afford?
Determining your home buying power is the most critical step in the real estate journey. While a bank might pre-approve you for a certain amount, understanding the relationship between your debt-to-income (DTI) ratio, down payment, and current interest rates is essential for maintaining financial health.
Understanding the Debt-to-Income (DTI) Ratio
Lenders typically use the DTI ratio to measure your ability to manage monthly payments. Most conventional loans prefer a 36% DTI, where no more than 36% of your gross monthly income goes toward debt payments (including your new mortgage). Some programs, like FHA loans, may allow up to 43% or even 50% in specific cases.
Key Factors Used in This Calculation
Gross Annual Income: Your total income before taxes and deductions.
Monthly Debts: These include recurring obligations like car loans, student loans, and minimum credit card payments.
Interest Rates: Even a 1% shift in rates can change your buying power by tens of thousands of dollars.
Down Payment: The cash you provide upfront. A 20% down payment typically eliminates the need for Private Mortgage Insurance (PMI).
Example Scenarios
Scenario 1: The Moderate Earner
An individual earning $75,000 per year with $500 in monthly debts and a $30,000 down payment. At a 6.5% interest rate, their maximum home price would be approximately $280,000 – $300,000, depending on local property taxes.
Scenario 2: The High-Debt Couple
A couple earning $120,000 combined but carrying $1,200 in monthly student loans and car notes. Despite their higher income, their buying power is significantly compressed because their "available" monthly income for a mortgage is reduced by their existing debt obligations.
Tips to Increase Your Affordability
Reduce Existing Debt: Paying off a car loan or credit card can instantly boost your maximum mortgage payment.
Improve Your Credit Score: A higher credit score secures lower interest rates, which lowers your monthly principal and interest payment.
Save a Larger Down Payment: This directly reduces the loan amount and can eliminate costly PMI fees.
Disclaimer: This calculator provides an estimate for Principal and Interest (P&I) only. It does not include property taxes, homeowners insurance, or HOA fees, which vary by location.