Determining how much mortgage you can afford is a crucial step in the home-buying process.
This calculator helps you estimate your potential borrowing capacity based on your financial
situation. It considers your income, existing debt obligations, down payment, and the loan's
terms. Lenders typically use debt-to-income ratios (DTI) to assess affordability. A common guideline
is that your total housing expenses (principal, interest, taxes, and insurance – PITI) should not
exceed 28% of your gross monthly income, and your total debt payments (including PITI) should not
exceed 36% of your gross monthly income. This calculator simplifies these concepts to give you a
ballpark figure.
Key Factors:
Annual Household Income: This is the combined gross income of all borrowers.
Total Monthly Debt Payments: This includes car loans, student loans, credit card payments, and any other recurring debt payments, *excluding* the potential mortgage payment.
Down Payment Amount: A larger down payment reduces the loan amount needed, making the mortgage more affordable.
Estimated Annual Interest Rate: Higher interest rates mean higher monthly payments for the same loan amount.
Loan Term (Years): A longer loan term typically results in lower monthly payments but more interest paid over the life of the loan.
The results from this calculator are for informational purposes only and should not be considered
a guarantee of loan approval or the exact amount a lender will offer. It's always recommended to
speak with a mortgage lender for a pre-approval and a precise understanding of your borrowing power.
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 <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
var grossMonthlyIncome = annualIncome / 12;
// Maximum PITI (Principal, Interest, Taxes, Insurance) based on 28% rule
var maxPiti = grossMonthlyIncome * 0.28;
// Maximum total debt payments (including PITI) based on 36% rule
var maxTotalDebt = grossMonthlyIncome * 0.36;
// Maximum allowable monthly mortgage payment (PITI) considering existing debt
var maxMortgagePayment = maxTotalDebt – monthlyDebt;
// Ensure maxMortgagePayment is not negative
if (maxMortgagePayment 0 && numberOfPayments > 0) {
// Using the loan payment formula rearranged to solve for principal (loan amount)
// M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1]
// P = M [ (1 + i)^n – 1] / [ i(1 + i)^n ]
maxLoanAmount = affordablePiti * (Math.pow(1 + monthlyInterestRate, numberOfPayments) – 1) / (monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments));
} else if (affordablePiti > 0 && monthlyInterestRate === 0) { // Handle zero interest rate case
maxLoanAmount = affordablePiti * numberOfPayments;
}
var estimatedMaxHomePrice = maxLoanAmount + downPayment;
// Format results for display
var formattedMaxLoanAmount = "$" + maxLoanAmount.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
var formattedEstimatedMaxHomePrice = "$" + estimatedMaxHomePrice.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
var formattedAffordablePiti = "$" + affordablePiti.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
var formattedGrossMonthlyIncome = "$" + grossMonthlyIncome.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
var formattedMonthlyDebt = "$" + monthlyDebt.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
resultDiv.innerHTML = "