The arithmetic behind Indian personal finance — reducing-balance EMI, prepayment, step-up SIP, GST Rule 88B interest, gratuity and new-regime income tax — extracted into a zero-dependency MIT library. Every figure on this page is computed live, in your browser, by that library. Nothing here is a hardcoded screenshot.
Source on GitHub · npm · powered the calculators at EMICalcs
These functions were pulled out of the calculators running at emicalcs.com because the arithmetic is the boring, reusable part — and because a surprising amount of Indian finance code on the internet gets three specific things wrong: it charges GST interest on the gross bill instead of the cash ledger, it treats a step-up SIP as free outperformance, and it hardcodes statutory figures that move by notification.
So: tax slabs, gratuity ceilings and GST rates are arguments with documented defaults, never hidden constants. You update them the day they change, without waiting for a release.
npm install indian-finance-formulas
The standard instalment on a reducing-balance loan. The one everyone knows, and the one worth getting exactly right, because a rupee of rounding here compounds across 240 instalments.
emi = P · i · (1+i)^n / ((1+i)^n − 1) i = annualRate / 12 / 100
Full calculator with amortisation schedule and charts: EMI calculator · home loan
Pay extra each month and keep the instalment constant, and the tenure shrinks. This is the version that saves the most interest, and it is the one most online tools model badly — they reduce the EMI instead, which feels better and saves far less.
prepayment({ principal: 3000000, annualRate: 8.5, months: 240, monthlyExtra: 5000 })
// { interestSaved, monthsSaved, newMonths, newInterest }
Full calculator: home loan prepayment calculator
A step-up SIP raises the monthly contribution by a fixed percentage every twelve months. It produces a bigger corpus than a flat SIP, and it is routinely sold as though the step-up itself were the reason.
It isn't. A step-up SIP does not beat a flat SIP of the same total outlay. It wins in headline terms only because more money goes in. Hold the money constant — put the same total into a flat schedule — and the flat schedule wins, because its rupees compound for longer. The playground below runs both, so you can see the gap close.
Full calculator: step-up SIP calculator · flat SIP
Rule 88B(1) charges interest on the tax actually debited from your electronic cash ledger — not on gross output liability. Running it on the gross bill is the single most common error in GST code, and it overstates the interest several times over.
gstInterest(30000, 30); // 443.84 — correct: ₹30,000 paid in cash gstInterest(100000, 30); // 1479.45 — the common error, 3.3× too high
Full calculator: GST interest calculator · GST calculator
Under the Code on Social Security, 2020 (in force 21 Nov 2025):
lastSalary × 15/26 × completedYears, capped. The cap is ₹20,00,000 for most
employees and ₹25,00,000 for Central Government civil employees — so it is an option, not a
constant. Service of six months or more rounds up to a full year.
Full calculator: gratuity calculator
Section 115BAC slabs, FY 2026-27 defaults. The part that trips up hand-written code is Section 87A marginal relief: tax is nil up to ₹12,00,000 taxable, but just above it the tax cannot exceed the income above the threshold. Without that clamp, earning one rupee more costs you tens of thousands — which is not what the law says.
incomeTaxNewRegime(1200000); // { tax: 0, cess: 0, total: 0 }
incomeTaxNewRegime(1210000); // clamped by marginal relief, not 61,500
Full calculator with both regimes, deductions and age bands: income tax calculator
amortisation() — month-by-month opening / interest / principal / closingsipFutureValue(), lumpsum(), cagr()gstAdd(), gstRemove() — inclusive and exclusive of taxannualContributionMaturity() — annual-contribution schemes such as
PPF and
Sukanya SamriddhiFull API, worked examples and the reasoning behind each default: github.com/javeed450-sudo/indian-finance-formulas.