Determining how much house you can afford is a crucial step in the home-buying process. This calculator helps you estimate your potential mortgage affordability by considering your income, existing debts, down payment, and the estimated mortgage terms.
How it works:
Annual Household Income: Enter the total income of all borrowers per year. This is the primary source for your mortgage payments.
Total Monthly Debt Payments: This includes all your recurring monthly debt obligations, such as car loans, student loans, and credit card minimum payments. Lenders use these to calculate your debt-to-income ratio (DTI).
Down Payment Amount: The upfront cash you contribute towards the purchase price of the home. A larger down payment generally means a smaller loan amount and potentially a lower interest rate.
Estimated Mortgage Interest Rate: This is the annual interest rate you anticipate for your mortgage. Current market rates fluctuate, so use an educated estimate.
Loan Term (Years): The duration over which you plan to repay the mortgage, commonly 15 or 30 years. A shorter term means higher monthly payments but less interest paid over time.
The calculator estimates your maximum affordable monthly mortgage payment (including principal, interest, taxes, and insurance – PITI) and then uses that to infer a potential maximum home price, assuming a standard down payment percentage and a typical property tax and homeowner's insurance rate. Lenders typically look for a total housing expense (PITI) to be no more than 28% of your gross monthly income (front-end DTI) and your total debt obligations (including housing) to be no more than 36% to 43% of your gross monthly income (back-end DTI). This calculator provides an estimate based on general lending guidelines.
Disclaimer: This calculator provides an estimated range and is for informational purposes only. It does not constitute financial advice. Your actual borrowing capacity will depend on a lender's specific underwriting criteria, credit score, loan programs, and other factors. It's essential to speak with a mortgage professional for a pre-approval.
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 = parseFloat(document.getElementById("loanTerm").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
if (isNaN(annualIncome) || isNaN(monthlyDebt) || isNaN(downPayment) || isNaN(interestRate) || isNaN(loanTerm) ||
annualIncome <= 0 || monthlyDebt < 0 || downPayment < 0 || interestRate <= 0 || loanTerm 80%
var frontEndDTI_max = 0.28; // Max PITI as % of gross monthly income
var backEndDTI_max = 0.36; // Max total debt as % of gross monthly income (conservative estimate)
var grossMonthlyIncome = annualIncome / 12;
var maxTotalMonthlyObligations = grossMonthlyIncome * backEndDTI_max;
var maxMonthlyHousingPayment = Math.min(grossMonthlyIncome * frontEndDTI_max, maxTotalMonthlyObligations – monthlyDebt);
if (maxMonthlyHousingPayment 80%.
// Let's assume the down payment is a reasonable percentage, say 20% for a starting point.
var assumedDownPaymentPercentage = 0.20;
var estimatedHomePriceGuess = (downPayment / assumedDownPaymentPercentage) + (maxMonthlyHousingPayment * 12 / (0.01 + 0.004)); // Rough estimate to get P&I part
var annualTaxes = estimatedHomePriceGuess * propertyTaxRate;
var annualInsurance = estimatedHomePriceGuess * homeownersInsuranceRate;
var monthlyTaxes = annualTaxes / 12;
var monthlyInsurance = annualInsurance / 12;
var loanAmountGuess = estimatedHomePriceGuess – downPayment;
var monthlyPmiGuess = 0;
if (loanAmountGuess / estimatedHomePriceGuess > 0.80) {
monthlyPmiGuess = (loanAmountGuess * pmiRate) / 12;
}
var maxMonthlyPI = maxMonthlyHousingPayment – monthlyTaxes – monthlyInsurance – monthlyPmiGuess;
if (maxMonthlyPI 0) {
maxLoanAmount = maxMonthlyPI * (1 – Math.pow(1 + r, -n)) / r;
} else { // handle 0% interest rate case, though highly unlikely for mortgages
maxLoanAmount = maxMonthlyPI * n;
}
// Recalculate home price based on this maxLoanAmount and actual downPayment
var maxHomePrice = maxLoanAmount + downPayment;
// Refine monthly taxes, insurance, and PMI based on the new maxHomePrice
annualTaxes = maxHomePrice * propertyTaxRate;
annualInsurance = maxHomePrice * homeownersInsuranceRate;
monthlyTaxes = annualTaxes / 12;
monthlyInsurance = annualInsurance / 12;
var actualLoanAmount = maxHomePrice – downPayment;
var actualMonthlyPmi = 0;
var loanToValue = actualLoanAmount / maxHomePrice;
if (loanToValue > 0.80) {
actualMonthlyPmi = (actualLoanAmount * pmiRate) / 12;
}
// Check if the calculated PITI fits within the maxMonthlyHousingPayment
var calculatedPiti = maxMonthlyPI + monthlyTaxes + monthlyInsurance + actualMonthlyPmi;
var affordabilityMessage = "";
if (calculatedPiti > maxMonthlyHousingPayment) {
affordabilityMessage = "Based on conservative DTI ratios and estimated property costs, your maximum affordable loan amount may be constrained further. The estimated maximum loan amount below is a projection.";
// We might need to re-iterate to find the precise loan amount that satisfies all conditions.
// For this version, we'll present the calculated values with a note.
}
var resultHTML = affordabilityMessage;
resultHTML += "Estimated Maximum Affordable Monthly Housing Payment (PITI): $" + maxMonthlyHousingPayment.toFixed(2) + "";
resultHTML += "(This includes Principal & Interest, Property Taxes, Homeowners Insurance, and potentially PMI)";
resultHTML += "Estimated Maximum Loan Amount: $" + maxLoanAmount.toFixed(2) + "";
resultHTML += "Estimated Maximum Home Price (with your down payment): $" + maxHomePrice.toFixed(2) + "";
resultHTML += "Note: This calculation uses general DTI guidelines (28% front-end, 36% back-end) and estimated property tax/insurance rates. Actual loan approval depends on lender criteria, credit score, and loan program.";
resultDiv.innerHTML = resultHTML;
}
.calculator-container {
font-family: sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 700px;
margin: 20px auto;
background-color: #f9f9f9;
}
.calculator-title {
text-align: center;
color: #333;
margin-bottom: 20px;
}
.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"] {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
}
.input-group input[type="number"]:focus {
border-color: #007bff;
outline: none;
}
.calculate-button {
display: block;
width: 100%;
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 18px;
cursor: pointer;
transition: background-color 0.3s ease;
margin-top: 10px;
}
.calculate-button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 25px;
padding: 15px;
border: 1px solid #d4edda;
background-color: #d4edda;
color: #155724;
border-radius: 4px;
text-align: center;
}
.calculator-result p {
margin: 10px 0;
font-size: 1.1em;
}
.calculator-result p em {
font-size: 0.9em;
color: #333;
}
.calculator-explanation {
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #eee;
color: #444;
}
.explanation-title {
color: #333;
margin-bottom: 15px;
}
.calculator-explanation p, .calculator-explanation ol {
line-height: 1.6;
margin-bottom: 15px;
}
.calculator-explanation ol {
padding-left: 20px;
}
.calculator-explanation li {
margin-bottom: 8px;
}