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 capacity based on your financial situation. It considers your income, existing debts, down payment, and prevailing interest rates.
Key Factors:
Annual Income: This is your primary source of funds for loan repayment. Lenders assess your income to ensure you can handle the monthly mortgage payments.
Existing Monthly Debt Payments: This includes payments for car loans, student loans, credit cards, and any other recurring debts. Lenders use these to calculate your Debt-to-Income (DTI) ratio, a critical metric for loan approval. A lower DTI generally means you are more likely to be approved for a larger loan.
Down Payment: The upfront amount you pay towards the purchase of the home. A larger down payment reduces the loan amount needed, lowers your monthly payments, and can help you avoid Private Mortgage Insurance (PMI).
Interest Rate: The percentage charged by the lender for borrowing money. Even small differences in interest rates can significantly impact your monthly payments and the total cost of the loan over its lifetime.
Loan Term: The duration over which you will repay the mortgage, typically 15 or 30 years. Shorter terms result in higher monthly payments but less interest paid overall. Longer terms have lower monthly payments but more interest paid.
How it Works:
This calculator uses common lending guidelines to estimate your maximum affordable mortgage payment. It factors in your income and subtracts your existing debts to determine the maximum portion of your income that can go towards a mortgage. It then uses the provided interest rate and loan term to calculate the principal amount you could borrow based on that maximum monthly payment.
Disclaimer: This calculator provides an estimate for informational purposes only and should not be considered a pre-approval or guarantee of a loan. Actual loan amounts and terms will depend on a lender's specific underwriting criteria, your credit score, property appraisal, and other factors. It's always recommended to speak with a mortgage professional for personalized advice.
function calculateMortgageAffordability() {
var annualIncome = parseFloat(document.getElementById("annualIncome").value);
var monthlyDebt = parseFloat(document.getElementById("monthlyDebt").value);
var downPayment = parseFloat(document.getElementById("downPayment").value);
var interestRate = parseFloat(document.getElementById("interestRate").value);
var loanTerm = parseInt(document.getElementById("loanTerm").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
// Input validation
if (isNaN(annualIncome) || annualIncome <= 0 ||
isNaN(monthlyDebt) || monthlyDebt < 0 ||
isNaN(downPayment) || downPayment < 0 ||
isNaN(interestRate) || interestRate <= 0 ||
isNaN(loanTerm) || loanTerm <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
// Common lending guidelines suggest lenders prefer a total DTI (including estimated housing costs)
// of no more than 43%, and often look at the 'front-end' DTI (housing costs only) as well.
// We'll use a simplified approach focusing on the portion of income available for mortgage.
var monthlyIncome = annualIncome / 12;
// Estimate maximum PITI (Principal, Interest, Taxes, Insurance) payment.
// A common guideline is that PITI should not exceed 28-36% of gross monthly income.
// Let's use 30% as a conservative estimate for maximum housing expense.
var maxHousingExpense = monthlyIncome * 0.30;
// Subtract existing monthly debts to find the maximum monthly mortgage payment (principal & interest only).
// We'll assume taxes and insurance are roughly covered within this, but for a precise calculation
// one would need estimates for property taxes and homeowner's insurance. For this calculator,
// we'll work backwards to estimate the loan principal based on P&I.
var maxPrincipalAndInterest = maxHousingExpense – monthlyDebt;
if (maxPrincipalAndInterest 0) {
principalLoanAmount = maxPrincipalAndInterest * (Math.pow(1 + monthlyInterestRate, numberOfPayments) – 1) / (monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments));
} else {
// If interest rate is 0 (unlikely for mortgages, but for edge case)
principalLoanAmount = maxPrincipalAndInterest * numberOfPayments;
}
// The maximum affordable *home price* is the loan amount plus the down payment.
var maxHomePrice = principalLoanAmount + downPayment;
// Format results for display
var formattedMaxHomePrice = maxHomePrice.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedPrincipalLoanAmount = principalLoanAmount.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedMaxPrincipalAndInterest = maxPrincipalAndInterest.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
resultDiv.innerHTML =
"Estimated Maximum Affordable Home Price: " + formattedMaxHomePrice + "" +
"(This includes your down payment of " + downPayment.toLocaleString(undefined, { style: 'currency', currency: 'USD' }) + ")" +
"Estimated Maximum Mortgage Loan Amount (Principal): " + formattedPrincipalLoanAmount + "" +
"(Based on an estimated maximum monthly Principal & Interest payment of " + formattedMaxPrincipalAndInterest + ")" +
"Note: This calculation assumes property taxes and homeowner's insurance are covered within the estimated 30% of gross monthly income for housing expenses. Actual loan approval depends on lender's full underwriting.";
}
.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: 15px;
margin-bottom: 20px;
}
.input-group {
display: flex;
flex-direction: column;
}
.input-group label {
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
.input-group input[type="number"],
.input-group input[type="text"] {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1em;
}
.input-group input[type="number"]:focus,
.input-group input[type="text"]:focus {
border-color: #007bff;
outline: none;
}
.calculator-container button {
display: block;
width: 100%;
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;
margin-bottom: 20px;
}
.calculator-container button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 20px;
padding: 15px;
border: 1px solid #e0e0e0;
border-radius: 4px;
background-color: #fff;
min-height: 80px; /* Ensure some height even when empty */
}
.calculator-result p {
margin-bottom: 10px;
font-size: 1.1em;
color: #333;
}
.calculator-result strong {
color: #0056b3;
}
.calculator-result small {
color: #777;
font-size: 0.9em;
}
.calculator-explanation {
margin-top: 30px;
border-top: 1px solid #eee;
padding-top: 20px;
color: #555;
font-size: 0.95em;
line-height: 1.6;
}
.calculator-explanation h3 {
color: #333;
margin-bottom: 15px;
}
.calculator-explanation ul {
margin-left: 20px;
margin-bottom: 15px;
}
.calculator-explanation li {
margin-bottom: 8px;
}