EMI Calculator
What is EMI?
EMI stands for Equated Monthly Installment. It is a fixed amount that you pay to the lender (like a bank or financial institution) every month on a specific date for a defined loan tenure. EMIs are a popular way to repay loans, including home loans, car loans, and personal loans.
Each EMI payment comprises two parts: the principal amount (the actual loan amount borrowed) and the interest charged on the loan. Initially, a larger portion of your EMI goes towards paying the interest, and as the loan tenure progresses, a greater part of the EMI is applied to reducing the principal balance.
How is EMI Calculated?
The formula used to calculate EMI is as follows:
EMI = P × r × (1 + r)^n / ((1 + r)^n – 1)
Where:
- P = Principal Loan Amount
- r = Monthly Interest Rate (Annual Interest Rate / 12 / 100)
- n = Loan Tenure in Months (Loan Tenure in Years * 12)
How to Use This Calculator
To use this EMI calculator, simply enter the following details:
- Loan Amount: The total sum of money you are borrowing.
- Annual Interest Rate: The yearly interest rate on your loan.
- Loan Tenure: The total duration (in years) for which you are taking the loan.
After entering these values, click the "Calculate EMI" button to see your estimated monthly installment. This calculator helps you understand your repayment obligations and plan your finances accordingly.
function calculateEMI() {
var loanAmount = document.getElementById("loanAmount").value;
var annualInterestRate = document.getElementById("annualInterestRate").value;
var loanTenure = document.getElementById("loanTenure").value;
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
// Input validation
if (loanAmount <= 0 || annualInterestRate <= 0 || loanTenure <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
// Convert inputs to numbers
loanAmount = parseFloat(loanAmount);
annualInterestRate = parseFloat(annualInterestRate);
loanTenure = parseFloat(loanTenure);
// Calculate monthly interest rate and tenure in months
var monthlyInterestRate = (annualInterestRate / 12) / 100;
var tenureInMonths = loanTenure * 12;
// Calculate EMI
var emi = loanAmount * monthlyInterestRate * Math.pow(1 + monthlyInterestRate, tenureInMonths) / (Math.pow(1 + monthlyInterestRate, tenureInMonths) – 1);
// Calculate total interest and total payment
var totalPayment = emi * tenureInMonths;
var totalInterest = totalPayment – loanAmount;
// Display the results
resultDiv.innerHTML = "
Your EMI Details:
" +
"
Monthly EMI: ₹" + emi.toFixed(2) + "" +
"
Total Principal Amount: ₹" + loanAmount.toFixed(2) + "" +
"
Total Interest Payable: ₹" + totalInterest.toFixed(2) + "" +
"
Total Payment (Principal + Interest): ₹" + totalPayment.toFixed(2) + "";
}
.calculator-container {
font-family: Arial, sans-serif;
max-width: 700px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ddd;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.calculator-title {
text-align: center;
color: #333;
margin-bottom: 20px;
}
.calculator-form {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 15px;
margin-bottom: 20px;
}
.form-group {
display: flex;
flex-direction: column;
}
.form-group label {
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
.form-group input[type="number"] {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
}
.calculator-form button {
grid-column: 1 / -1; /* Span across both columns */
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 18px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.calculator-form button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 20px;
padding: 15px;
background-color: #e9ecef;
border: 1px solid #dee2e6;
border-radius: 4px;
text-align: center;
}
.calculator-result h3 {
margin-top: 0;
color: #333;
}
.calculator-result p {
margin-bottom: 8px;
color: #444;
}
.calculator-result strong {
color: #007bff;
}
.calculator-explanation {
margin-top: 30px;
border-top: 1px solid #eee;
padding-top: 20px;
}
.calculator-explanation h2 {
color: #333;
margin-bottom: 15px;
}
.calculator-explanation p, .calculator-explanation li {
color: #555;
line-height: 1.6;
margin-bottom: 10px;
}
.calculator-explanation ul {
padding-left: 20px;
}
.calculator-explanation code {
background-color: #f8f9fa;
padding: 2px 5px;
border-radius: 3px;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
}