How Do You Calculate Interest Rate on a Savings Account
by
Mortgage Affordability Calculator
Understanding how much mortgage you can afford is a crucial first step in the home-buying process. This calculator helps you estimate your maximum borrowing capacity based on your income, debts, and down payment. It's important to remember that this is an estimate, and lenders will have their own specific criteria and risk assessments.
Your Estimated Maximum Mortgage Amount:
$0.00
Your Estimated Maximum Home Price:
$0.00
function calculateAffordability() {
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) / 100;
var loanTerm = parseInt(document.getElementById("loanTerm").value);
var maxMortgageAmount = 0;
var maxHomePrice = 0;
if (isNaN(annualIncome) || isNaN(monthlyDebt) || isNaN(downPayment) || isNaN(interestRate) || isNaN(loanTerm) ||
annualIncome < 0 || monthlyDebt < 0 || downPayment < 0 || interestRate < 0 || loanTerm 0) {
var monthlyInterestRate = interestRate / 12;
var numberOfPayments = loanTerm * 12;
maxMortgageAmount = affordableMonthlyPayment * (Math.pow(1 + monthlyInterestRate, numberOfPayments) – 1) / (monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments));
} else {
// If interest rate is 0, max mortgage is simply the affordable payment times number of months
maxMortgageAmount = affordableMonthlyPayment * (loanTerm * 12);
}
// Ensure max mortgage is not negative
maxMortgageAmount = Math.max(0, maxMortgageAmount);
// Calculate maximum home price
maxHomePrice = maxMortgageAmount + downPayment;
document.getElementById("maxMortgageAmount").textContent = "$" + maxMortgageAmount.toFixed(2);
document.getElementById("maxHomePrice").textContent = "$" + maxHomePrice.toFixed(2);
}