FINANCE

COMPOUND Interest

Calculate compound interest with custom compounding frequency and year-by-year growth.

TOTAL AMOUNT

Principal
Interest Earned
Effective Annual Rate

YEAR-BY-YEAR GROWTH

YearOpening (₹)Interest (₹)Closing (₹)
Developer Reference

Core Algorithm & Standalone Script

Standalone, zero-dependency JavaScript implementation powering this tool. Free to inspect, copy, and build upon.

const fmt = n => Math.round(n).toLocaleString('en-IN');
  const fmtRs = n => '₹' + fmt(n);

  function link(iId, sId, fn) {
    const i = document.getElementById(iId), s = document.getElementById(sId);
    i.addEventListener('input', () => { s.value = i.value; fn(); });
    s.addEventListener('input', () => { i.value = s.value; fn(); });
  }
  link('inp-principal', 'sl-principal', calc);
  link('inp-rate', 'sl-rate', calc);
  link('inp-years', 'sl-years', calc);
  document.getElementById('sel-freq').addEventListener('change', calc);

  function calc() {
    const P = parseFloat(document.getElementById('inp-principal').value) || 0;
    const r = parseFloat(document.getElementById('inp-rate').value) / 100;
    const t = parseInt(document.getElementById('inp-years').value) || 0;
    const n = parseInt(document.getElementById('sel-freq').value);

    const A = P * Math.pow(1 + r / n, n * t);
    const interest = A - P;
    const ear = (Math.pow(1 + r / n, n) - 1) * 100;

    document.getElementById('val-total').textContent = fmtRs(A);
    document.getElementById('val-principal').textContent = fmtRs(P);
    document.getElementById('val-interest').textContent = fmtRs(interest);
    document.getElementById('val-ear').textContent = ear.toFixed(2) + '%';

    let html = '', balance = P;
    for (let y = 1; y <= t; y++) {
      const closing = P * Math.pow(1 + r / n, n * y);
      const yearInterest = closing - balance;
      html += `<tr><td>${y}</td><td>${fmt(balance)}</td><td>${fmt(yearInterest)}</td><td>${fmt(closing)}</td></tr>`;
      balance = closing;
    }
    document.getElementById('growth-body').innerHTML = html;
  }
  calc();