Mortgage Calculator

Mortgage Calculator

Modify the values and click the calculate button to use

Annual Tax & Cost

13%

Property Taxes: $${(propertyTaxes * homePrice / 100).toFixed(2)}

4%

Home Insurance: $${homeInsurance.toFixed(2)}

11%

Other Costs: $${otherCosts.toFixed(2)}

Summary

House Price: $${homePrice.toFixed(2)}

Loan Amount: $${loanAmount.toFixed(2)}

Down Payment: $${downPayment.toFixed(2)}

Total of ${loanTerm} Mortgage Payments: $${(monthlyPayment * loanTerm).toFixed(2)}

Total Interest: $${((monthlyPayment * loanTerm) - loanAmount).toFixed(2)}

Mortgage Payoff Date: ${calculatePayoffDate(startDate, loanTerm)}

Latest Mortgage Rates:

30 Years: 7.03%

15 Years: 6.38%

10 Years: 6.57%

`;// Create a chart createAmortizationChart(loanAmount, interestRate, loanTerm, startDate, monthlyPayment, propertyTaxes, homeInsurance, pmiInsurance, hoaFee, otherCosts); }function calculateMonthlyPayment(amount, interestRate, term) { const monthlyInterestRate = interestRate / 100 / 12; return (amount * monthlyInterestRate) / (1 - Math.pow(1 + monthlyInterestRate, -term)); }function calculateTotalCost(monthlyPayment, propertyTaxes, homeInsurance, pmiInsurance, hoaFee, otherCosts, term) { return monthlyPayment * term + (propertyTaxes * homePrice / 100) + homeInsurance + pmiInsurance + hoaFee + otherCosts; }function calculatePayoffDate(startDate, term) { const startYear = parseInt(startDate.split('-')[0]); return `Dec. ${startYear + term}`; }function createAmortizationChart(loanAmount, interestRate, term, startDate, monthlyPayment, propertyTaxes, homeInsurance, pmiInsurance, hoaFee, otherCosts) { const ctx = document.getElementById('amortization-chart').getContext('2d'); const data = calculateAmortizationData(loanAmount, interestRate, term, startDate, monthlyPayment, propertyTaxes, homeInsurance, pmiInsurance, hoaFee, otherCosts); const options = { scales: { x: { title: { display: true, text: 'Year', }, }, y: { title: { display: true, text: 'Balance ($)', }, }, }, };new Chart(ctx, { type: 'line', data: data, options: options, }); }function calculateAmortizationData(loanAmount, interestRate, term, startDate, monthlyPayment, propertyTaxes, homeInsurance, pmiInsurance, hoaFee, otherCosts) { const labels = Array.from({ length: term + 1 }, (_, i) => i); // Years as labels const datasets = [ { label: 'Balance Over Time', data: Array.from({ length: term + 1 }, (_, i) => calculateRemainingBalance(loanAmount, interestRate, term, i, startDate, monthlyPayment, propertyTaxes, homeInsurance, pmiInsurance, hoaFee, otherCosts) ), borderColor: 'rgba(75, 192, 192, 1)', borderWidth: 2, fill: false, }, ];return { labels: labels, datasets: datasets }; }function calculateRemainingBalance(loanAmount, interestRate, term, year, startDate, monthlyPayment, propertyTaxes, homeInsurance, pmiInsurance, hoaFee, otherCosts) { const monthlyInterestRate = interestRate / 100 / 12; const totalPayments = year * 12; const remainingBalance = loanAmount * Math.pow(1 + monthlyInterestRate, totalPayments) - (monthlyPayment / monthlyInterestRate) * (Math.pow(1 + monthlyInterestRate, totalPayments) - 1); return remainingBalance + (propertyTaxes * homePrice / 100) + homeInsurance + pmiInsurance + hoaFee + otherCosts; }

Share this post

APA
MLA
Harvard

APA Citation

Author:

Title:

Source:

Date:

MLA Citation

. . .

Harvard Citation

() ''. . (Accessed: ).

       

Leave a Reply

Your email address will not be published. Required fields are marked *

PHP Code Snippets Powered By : XYZScripts.com