Calculate how much house you can afford based on income and DTI.
$
$
Include student loans, car payments, min credit card payments.
$
%
Years
$
$
Please fill in all required fields with valid numbers.
Estimated Maximum Home Price
$0
Monthly P&I
$0
Total Monthly Pmt
$0
Debt-to-Income
0%
*Based on a standard 36% front-end and 43% back-end debt-to-income ratio.
function calculateAffordability() {
// 1. Get Inputs
var grossIncome = parseFloat(document.getElementById('grossIncome').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 annualTax = parseFloat(document.getElementById('annualTax').value);
var annualIns = parseFloat(document.getElementById('annualIns').value);
var errorDiv = document.getElementById('errorDisplay');
var resultDiv = document.getElementById('results');
// 2. Validate Inputs
if (isNaN(grossIncome) || isNaN(downPayment) || isNaN(interestRate) || isNaN(loanTerm)) {
errorDiv.style.display = 'block';
resultDiv.style.display = 'none';
return;
}
// Handle optional fields being 0 or NaN
if (isNaN(monthlyDebt)) monthlyDebt = 0;
if (isNaN(annualTax)) annualTax = 0;
if (isNaN(annualIns)) annualIns = 0;
errorDiv.style.display = 'none';
// 3. Define Logic Constants (Standard Lending Guidelines)
var frontEndRatio = 0.28; // 28% of income for housing
var backEndRatio = 0.36; // 36% of income for housing + debts
// Note: FHA can go higher, but we act as a conservative financial advisor here.
// Let's use slightly more aggressive conventional limits for realistic modern scenarios:
// Conventional 36/43 is common.
var maxHousingRatio = 0.36;
var maxTotalDebtRatio = 0.43;
var monthlyIncome = grossIncome / 12;
var monthlyTaxAndIns = (annualTax + annualIns) / 12;
// 4. Calculate Max Allowable Monthly Housing Payment
// Method A: Based purely on housing ratio
var limitA = monthlyIncome * maxHousingRatio;
// Method B: Based on total debt ratio minus existing debts
var limitB = (monthlyIncome * maxTotalDebtRatio) – monthlyDebt;
// The lender will use the LOWER of the two limits
var maxTotalMonthlyPayment = Math.min(limitA, limitB);
// If debts are too high, max payment might be negative
if (maxTotalMonthlyPayment <= monthlyTaxAndIns) {
document.getElementById('maxPriceDisplay').innerHTML = "$0";
document.getElementById('monthlyPIDisplay').innerHTML = "$0";
document.getElementById('totalMonthlyDisplay').innerHTML = "$0";
document.getElementById('dtiDisplay').innerHTML = "High Debt";
resultDiv.style.display = 'block';
return;
}
// 5. Calculate Max Principal & Interest (P&I) Payment
var maxPrincipalAndInterest = maxTotalMonthlyPayment – monthlyTaxAndIns;
// 6. Reverse Calculate Loan Amount from P&I
// Formula: Loan = Payment * ( ( (1+r)^n ) – 1 ) / ( r * (1+r)^n )
var monthlyRate = (interestRate / 100) / 12;
var numberOfPayments = loanTerm * 12;
var maxLoanAmount = 0;
if (interestRate === 0) {
maxLoanAmount = maxPrincipalAndInterest * numberOfPayments;
} else {
var mathPower = Math.pow(1 + monthlyRate, numberOfPayments);
maxLoanAmount = maxPrincipalAndInterest * ( (mathPower – 1) / (monthlyRate * mathPower) );
}
// 7. Calculate Max Home Price
var maxHomePrice = maxLoanAmount + downPayment;
// 8. Calculate Actual DTI for display
var actualTotalDebt = monthlyDebt + maxTotalMonthlyPayment;
var finalDTI = (actualTotalDebt / monthlyIncome) * 100;
// 9. Display Results
// Currency formatting
var formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
maximumFractionDigits: 0
});
document.getElementById('maxPriceDisplay').innerHTML = formatter.format(maxHomePrice);
document.getElementById('monthlyPIDisplay').innerHTML = formatter.format(maxPrincipalAndInterest);
document.getElementById('totalMonthlyDisplay').innerHTML = formatter.format(maxTotalMonthlyPayment);
document.getElementById('dtiDisplay').innerHTML = finalDTI.toFixed(1) + "%";
resultDiv.style.display = 'block';
}
Understanding Your Home Affordability
Determining "how much house can I afford" is the first critical step in the home buying journey. This calculator uses the standard debt-to-income (DTI) ratios employed by mortgage lenders to estimate your maximum purchasing power. Unlike a simple mortgage calculator which tells you the payment for a specific price, this tool works backward from your income and debts to find your price ceiling.
How Is Affordability Calculated?
Lenders look at two primary ratios to decide how much they will lend you:
Front-End Ratio: The percentage of your annual gross income that goes toward housing costs (Mortgage principal, interest, taxes, and insurance). Lenders typically prefer this to be under 28% to 36%.
Back-End Ratio: The percentage of your gross income that goes toward housing costs plus all other monthly recurring debts (student loans, car payments, credit cards). Lenders typically cap this at 43% for conventional loans.
Factors That Reduce Your Buying Power
Even with a high income, your affordability can be significantly reduced by:
High Monthly Debts: A $500 car payment can reduce your mortgage buying power by nearly $75,000 depending on interest rates.
Property Taxes: High tax areas increase your monthly obligation, reducing the amount available for the mortgage principal.
Interest Rates: As rates rise, the cost to borrow increases, directly lowering the maximum loan amount your income can support.
Tips to Increase Your Affordability
To qualify for a more expensive home, you can focus on three levers: increasing your down payment (which lowers the loan amount needed), paying off monthly debts to improve your DTI ratio, or shopping for a lower interest rate to maximize the loan amount your monthly payment can cover.