Determining your budget is the critical first step in the home buying process. This Mortgage Affordability Calculator uses the standard debt-to-income (DTI) ratios preferred by lenders to estimate your maximum purchasing power. By inputting your income, debts, and down payment, you can see a realistic price range that keeps your finances healthy.
Understanding the Calculation Logic
Most lenders utilize the 28/36 Rule to decide how much they will lend you. Here is how it works:
Front-End Ratio (28%): Your housing costs (mortgage principal, interest, taxes, insurance, and HOA) should not exceed 28% of your gross monthly income.
Back-End Ratio (36%): Your total monthly debt payments (housing costs + credit cards, student loans, car loans, etc.) should not exceed 36% of your gross monthly income.
This calculator determines the maximum monthly payment allowed under both rules and uses the lower number to ensure you don't overextend yourself.
Key Factors That Impact Your Affordability
Several variables can drastically change your buying power:
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.
Monthly Debts: High car payments or student loans reduce the "Back-End" allowance, directly lowering the amount available for a mortgage.
Down Payment: A larger down payment reduces the loan amount needed, allowing you to buy a more expensive home for the same monthly payment.
Example Scenario
Consider a household with an annual income of $90,000 ($7,500/month) and $500 in monthly debts. Using the 28% rule, the max housing payment is $2,100. Using the 36% rule, the total allowed debt is $2,700; subtracting the $500 existing debt leaves $2,200 for housing. The lender will use the lower limit ($2,100). If property taxes and insurance cost $500/month, you have $1,600 left for principal and interest, which determines your loan amount.
function calculateAffordability() {
// 1. Get Input Values
var annualIncome = parseFloat(document.getElementById('annualIncome').value) || 0;
var monthlyDebts = parseFloat(document.getElementById('monthlyDebts').value) || 0;
var downPayment = parseFloat(document.getElementById('downPayment').value) || 0;
var interestRate = parseFloat(document.getElementById('interestRate').value) || 0;
var years = parseInt(document.getElementById('loanTerm').value) || 30;
var annualTax = parseFloat(document.getElementById('propertyTax').value) || 0;
var annualIns = parseFloat(document.getElementById('homeInsurance').value) || 0;
var monthlyHOA = parseFloat(document.getElementById('hoaFees').value) || 0;
// Validation
if (annualIncome <= 0 || interestRate <= 0) {
alert("Please enter a valid income and interest rate greater than zero.");
return;
}
// 2. Calculate Monthly Variables
var monthlyIncome = annualIncome / 12;
var monthlyTax = annualTax / 12;
var monthlyIns = annualIns / 12;
var monthlyOtherHousing = monthlyTax + monthlyIns + monthlyHOA;
// 3. Determine Max Allowable Payment based on Ratios
// Rule 1: Front-end (Housing expenses <= 28% of Income)
var maxHousingFront = monthlyIncome * 0.28;
// Rule 2: Back-end (Total Debt <= 36% of Income)
// Max Total Debt = Income * 0.36
// Max Housing = Max Total Debt – Existing Monthly Debts
var maxTotalDebtBack = monthlyIncome * 0.36;
var maxHousingBack = maxTotalDebtBack – monthlyDebts;
// The limiting factor is the lower of the two
var maxAllowedHousingPayment = Math.min(maxHousingFront, maxHousingBack);
// If debts are too high, affordability might be zero or negative
if (maxAllowedHousingPayment <= monthlyOtherHousing) {
document.getElementById('resultsArea').style.display = 'block';
document.getElementById('maxHomePrice').innerText = "$0";
document.getElementById('resLoanAmount').innerText = "Debt too high";
document.getElementById('resDownPayment').innerText = "$" + downPayment.toLocaleString();
document.getElementById('resPI').innerText = "$0";
document.getElementById('resTIH').innerText = "$" + monthlyOtherHousing.toFixed(0);
document.getElementById('resTotalMonthly').innerText = "$" + monthlyOtherHousing.toFixed(0);
return;
}
// 4. Calculate Max Principal & Interest (P&I) Payment
var maxPI = maxAllowedHousingPayment – monthlyOtherHousing;
// 5. Calculate Loan Amount from Max PI
// Formula: PV = PMT * (1 – (1+r)^-n) / r
var r = (interestRate / 100) / 12; // Monthly interest rate
var n = years * 12; // Total number of payments
var loanAmount = maxPI * (1 – Math.pow(1 + r, -n)) / r;
// 6. Calculate Home Price
var homePrice = loanAmount + downPayment;
// 7. Display Results
document.getElementById('resultsArea').style.display = 'block';
// Helper formatting function
function formatMoney(num) {
return "$" + Math.floor(num).toLocaleString();
}
document.getElementById('maxHomePrice').innerText = formatMoney(homePrice);
document.getElementById('resLoanAmount').innerText = formatMoney(loanAmount);
document.getElementById('resDownPayment').innerText = formatMoney(downPayment);
document.getElementById('resPI').innerText = formatMoney(maxPI);
document.getElementById('resTIH').innerText = formatMoney(monthlyOtherHousing);
document.getElementById('resTotalMonthly').innerText = formatMoney(maxAllowedHousingPayment);
}