Mortgage Affordability Calculator
Understanding Mortgage Affordability
Determining how much house you can afford is a crucial step in the home-buying process.
This mortgage affordability calculator helps you estimate your potential borrowing power
based on your income, down payment, interest rates, loan terms, and existing debts.
How it Works:
Lenders typically use debt-to-income (DTI) ratios to assess your ability to repay a loan.
Two common DTI thresholds are 28% and 36%.
- Front-End Ratio (28% Rule): This rule suggests that your total housing expenses
(principal, interest, taxes, and insurance – PITI) should not exceed 28% of your gross monthly income.
- Back-End Ratio (36% Rule): This rule states that all your monthly debt payments,
including your potential mortgage payment, should not exceed 36% of your gross monthly income.
This calculator estimates your maximum affordable loan amount by considering these DTI ratios,
your down payment, and the estimated costs of a mortgage.
Factors Influencing Affordability:
- Annual Household Income: The higher your income, the more you can generally borrow.
- Down Payment: A larger down payment reduces the loan amount needed and can sometimes lead to better interest rates.
- Interest Rate: Higher interest rates significantly increase your monthly payments and reduce your borrowing capacity.
- Loan Term: Longer loan terms result in lower monthly payments but higher total interest paid over time. Shorter terms mean higher monthly payments but less interest overall.
- Other Monthly Debt Payments: Existing debts reduce the amount of income available for a mortgage payment, thus lowering your affordability.
Important Note: This calculator provides an estimate only. Your actual borrowing
limit will be determined by the lender after a thorough review of your credit history,
financial situation, and the specific property you intend to purchase. It's always recommended
to speak with a mortgage professional for personalized advice.
function calculateAffordability() {
var annualIncome = parseFloat(document.getElementById("annualIncome").value);
var downPayment = parseFloat(document.getElementById("downPayment").value);
var interestRate = parseFloat(document.getElementById("interestRate").value);
var loanTerm = parseFloat(document.getElementById("loanTerm").value);
var monthlyDebt = parseFloat(document.getElementById("monthlyDebt").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
// Input validation
if (isNaN(annualIncome) || annualIncome <= 0 ||
isNaN(downPayment) || downPayment < 0 ||
isNaN(interestRate) || interestRate <= 0 ||
isNaN(loanTerm) || loanTerm <= 0 ||
isNaN(monthlyDebt) || monthlyDebt < 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
var grossMonthlyIncome = annualIncome / 12;
var monthlyInterestRate = interestRate / 100 / 12;
var numberOfPayments = loanTerm * 12;
// Calculate maximum PITI based on 28% rule
var maxPITI_28 = grossMonthlyIncome * 0.28;
// Calculate maximum total monthly debt based on 36% rule
var maxTotalMonthlyDebt_36 = grossMonthlyIncome * 0.36;
// Calculate maximum allowed mortgage payment (PITI) based on 36% rule, subtracting existing debts
var maxPITI_36 = maxTotalMonthlyDebt_36 – monthlyDebt;
// The actual maximum PITI is the lower of the two rules
var maxPITI = Math.min(maxPITI_28, maxPITI_36);
// If maxPITI becomes negative due to high existing debt, affordability is $0
if (maxPITI 0 && numberOfPayments > 0) {
maxLoanAmount = maxPITI * (Math.pow(1 + monthlyInterestRate, numberOfPayments) – 1) / (monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments));
} else if (maxPITI > 0) { // If interest rate is 0 (unlikely for mortgages, but mathematically)
maxLoanAmount = maxPITI * numberOfPayments;
}
// The estimated affordable home price is the loan amount plus the down payment
var affordableHomePrice = maxLoanAmount + downPayment;
// Format results for display
var formattedMaxLoanAmount = maxLoanAmount.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedAffordableHomePrice = affordableHomePrice.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedMaxPITI = maxPITI.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedGrossMonthlyIncome = grossMonthlyIncome.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
resultDiv.innerHTML = `
Estimated Affordability:
Gross Monthly Income: ${formattedGrossMonthlyIncome}
Maximum PITI (Principal, Interest, Taxes, Insurance) based on 28% rule: ${formattedMaxPITI_28.toLocaleString(undefined, { style: 'currency', currency: 'USD' })}
Maximum Total Monthly Debt (including new mortgage) based on 36% rule: ${maxTotalMonthlyDebt_36.toLocaleString(undefined, { style: 'currency', currency: 'USD' })}
Maximum PITI allowed considering your other debts: ${formattedMaxPITI_36.toLocaleString(undefined, { style: 'currency', currency: 'USD' })}
Your estimated maximum PITI: ${formattedMaxPITI}
Estimated Maximum Loan Amount: ${formattedMaxLoanAmount}
Estimated Maximum Home Purchase Price (Loan + Down Payment): ${formattedAffordableHomePrice}
Note: This is an estimate. Actual loan amounts and home prices depend on lender approval and market conditions. Taxes and insurance (TI) are estimates and can vary significantly by location.
`;
}
.calculator-container {
font-family: sans-serif;
max-width: 800px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ddd;
border-radius: 8px;
background-color: #f9f9f9;
}
.calculator-container h2 {
text-align: center;
color: #333;
margin-bottom: 25px;
}
.calculator-inputs {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.form-group {
display: flex;
flex-direction: column;
}
.form-group label {
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
.form-group input {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1em;
}
.form-group input::placeholder {
color: #aaa;
}
.calculator-inputs button {
grid-column: 1 / -1; /* Span across all columns */
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 1.1em;
cursor: pointer;
transition: background-color 0.3s ease;
}
.calculator-inputs button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 30px;
padding: 20px;
background-color: #eef7ff;
border: 1px solid #b3d7ff;
border-radius: 4px;
}
.calculator-result h3 {
color: #0056b3;
margin-top: 0;
}
.calculator-result p {
margin-bottom: 10px;
line-height: 1.5;
}
.calculator-explanation {
margin-top: 40px;
padding-top: 20px;
border-top: 1px solid #eee;
font-size: 0.95em;
line-height: 1.6;
color: #444;
}
.calculator-explanation h3 {
color: #333;
}
.calculator-explanation ul {
margin-left: 20px;
padding-left: 0;
}
.calculator-explanation li {
margin-bottom: 8px;
}