npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

finance-formulas

v1.8.1

Published

Simple finance calculation utilities

Readme

finance-formulas

Build finance calculators in minutes, not weekends.

Every fintech app eventually needs the same formulas.

SIP. SWP. EMI. FD. CAGR. Retirement corpus. Present value. Future value.

And somehow, every developer ends up rewriting them from scratch.

finance-formulas gives you clean, tested, TypeScript-first finance math you can drop into your app and ship.

The Finance Math Layer Your App Deserves

Finance calculators look simple until they are wrong.

A tiny rounding bug can break an EMI estimate. A slightly off return formula can mislead a retirement planner. A copied spreadsheet formula can quietly drift away from what your product actually needs.

This package exists so developers, indie hackers, fintech builders, and students can stop rebuilding the same formulas again and again.

Use it like a tiny finance engine:

  • Plug it into calculators, dashboards, onboarding flows, and learning tools
  • Trust tested formulas instead of random snippets
  • Keep your app code focused on product, UI, and user experience

Badges

npm version Downloads License CI TypeScript

Why This Exists

Finance math is easy to underestimate.

You start with one SIP calculator.

Then someone asks for inflation.

Then EMI.

Then retirement corpus.

Then SWP for FIRE planning.

Then variable returns because real markets are not flat lines.

Before you know it, your app has a pile of formulas, edge cases, rounding differences, and tests you did not plan to write.

finance-formulas packages those battle-tested formulas into simple, predictable functions.

No drama. No hidden state. Just numbers in, numbers out.

Features

  • SIP calculator for monthly wealth building
  • SWP calculator for retirement and FIRE withdrawal planning
  • EMI calculator for loans and mortgages
  • FD calculator for fixed deposit maturity values
  • CAGR calculator for investment growth comparison
  • Present Value and Future Value calculators
  • Real return calculator for inflation-adjusted return analysis
  • Retirement Corpus calculator for long-term planning
  • Rule of 72 / Time to Double calculator
  • Variable Returns compounding for real-world market scenarios
  • Inflation-adjusted SIP support
  • Total loan interest calculation

Install

npm install finance-formulas
yarn add finance-formulas
pnpm add finance-formulas

Live Demo

See all formulas implemented in a sample finance calculators website:

https://finance-calculators-indol.vercel.app/

Quick Examples

Plan Monthly Wealth Growth

import { calculateSIP } from "finance-formulas";

calculateSIP(5000, 12, 10);
// 1161695

Estimate How Long Retirement Money Lasts

import { calculateSWP } from "finance-formulas";

calculateSWP(1000000, 15000, 6);
// 82 months

Show Loan EMI Instantly

import { calculateEMI } from "finance-formulas";

calculateEMI(500000, 8.5, 20);
// { emi: 4339, totalPayment: 1041388, totalInterest: 541388 }

Model Real-World Market Returns

import { compoundWithVariableReturns } from "finance-formulas";

compoundWithVariableReturns(1000, [4, 9, -2, 12]);
// 1244

Calculate Inflation-Adjusted Real Return

import { calculateRealReturn } from "finance-formulas";

calculateRealReturn(10, 5);
// 4.761904761904762

Who Is This For?

  • Fintech apps that need fast, reliable calculators
  • Indie hackers shipping money tools
  • SaaS dashboards with finance widgets
  • FIRE and retirement planning projects
  • Interview prep and coding practice
  • Students learning finance math
  • Builders tired of copying formulas from random blog posts

Design Philosophy

  • Pure functions
  • No runtime dependencies
  • Tree-shakable exports
  • Fully typed TypeScript API
  • Tested calculator behavior
  • Tiny surface area
  • Works in JavaScript and TypeScript

Roadmap

More calculators are coming.

  • XIRR
  • IRR
  • NPV
  • Inflation-adjusted retirement planning
  • Step-up SIP
  • Goal-based investment calculator
  • Loan prepayment calculator
  • Debt snowball calculator
  • Asset allocation helpers
  • Tax-aware return calculators

Have a formula you keep rewriting? Open an issue or send a PR.

Call To Action

If this saves you from writing one more finance formula by hand:

  • Star the repo
  • Share it with a developer building money tools
  • Use it in your next fintech side project
  • Contribute a calculator the ecosystem needs

Small formulas power big products.

Footer Tagline

Build the product. Let finance-formulas handle the math.