FINANCE
EMI Calculator
Calculate monthly EMI, total interest payable, and full amortization schedule for any loan.
MONTHLY EMI
₹0
—
Principal Amount
—
Total Interest Payable
—
Total Amount Payable
—
Interest as % of Principal
AMORTIZATION SCHEDULE
| Month | Principal (₹) | Interest (₹) | Balance (₹) |
|---|
Developer Reference
Core Algorithm & Standalone Script
Standalone, zero-dependency JavaScript implementation powering this tool. Free to inspect, copy, and build upon.
function inFmt(n) { return Math.round(n).toLocaleString('en-IN'); }
function fmtRs(n) { return '₹' + inFmt(n); }
// Link input <-> slider
function linkInputSlider(inputId, sliderId, onChange) {
const inp = document.getElementById(inputId);
const sl = document.getElementById(sliderId);
inp.addEventListener('input', () => { sl.value = inp.value; onChange(); });
sl.addEventListener('input', () => { inp.value = sl.value; onChange(); });
}
linkInputSlider('inp-amount', 'sl-amount', calculate);
linkInputSlider('inp-rate', 'sl-rate', calculate);
linkInputSlider('inp-tenure', 'sl-tenure', calculate);
let fullAmort = [];
let showingAll = false;
document.getElementById('show-all-btn').addEventListener('click', () => {
showingAll = !showingAll;
renderAmort();
document.getElementById('show-all-btn').textContent = showingAll ? 'Show less' : 'Show all months';
});
function calculate() {
const P = parseFloat(document.getElementById('inp-amount').value);
const annualRate = parseFloat(document.getElementById('inp-rate').value);
const n = parseInt(document.getElementById('inp-tenure').value);
// Tenure hint
const yrs = Math.floor(n / 12);
const mos = n % 12;
let hint = '';
if (yrs > 0 && mos > 0) hint = `${yrs} yr ${mos} mo`;
else if (yrs > 0) hint = `${yrs} year${yrs > 1 ? 's' : ''}`;
else hint = `${mos} month${mos > 1 ? 's' : ''}`;
document.getElementById('tenure-years').textContent = hint;
if (!P || !annualRate || !n || P <= 0 || annualRate <= 0 || n <= 0) return;
const r = annualRate / 12 / 100;
const emi = P * r * Math.pow(1 + r, n) / (Math.pow(1 + r, n) - 1);
const totalPayable = emi * n;
const totalInterest = totalPayable - P;
const intPct = (totalInterest / P) * 100;
document.getElementById('emi-big').textContent = fmtRs(emi);
document.getElementById('val-principal').textContent = fmtRs(P);
document.getElementById('val-interest').textContent = fmtRs(totalInterest);
document.getElementById('val-total').textContent = fmtRs(totalPayable);
document.getElementById('val-int-pct').textContent = intPct.toFixed(1) + '%';
// Build amort schedule
fullAmort = [];
let balance = P;
for (let m = 1; m <= n; m++) {
const interestPart = balance * r;
const principalPart = emi - interestPart;
balance -= principalPart;
fullAmort.push({
month: m,
principal: principalPart,
interest: interestPart,
balance: Math.max(0, balance)
});
}
showingAll = false;
document.getElementById('show-all-btn').textContent = 'Show all months';
renderAmort();
const btn = document.getElementById('show-all-btn');
btn.classList.toggle('hidden', fullAmort.length <= 12);
}
function renderAmort() {
const rows = showingAll ? fullAmort : fullAmort.slice(0, 12);
const tbody = document.getElementById('amort-body');
tbody.innerHTML = rows.map(r =>
`<tr>
<td>${r.month}</td>
<td>${inFmt(r.principal)}</td>
<td>${inFmt(r.interest)}</td>
<td>${inFmt(r.balance)}</td>
</tr>`
).join('');
}
calculate();