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

@toolsnap/compound-interest-calculator

v1.0.1

Published

Free online Compound Interest Calculator. Calculate compound interest with different compounding frequencies, contributions, and inflation adjustment.

Readme

@toolsnap/compound-interest-calculator

A lightweight, zero-dependency JavaScript library for calculating compound interest, monthly contribution growth, and effective annual rates.

Features

  • 📈 Compound interest calculation with configurable frequency (annual, quarterly, monthly, daily)
  • 💰 Monthly contribution support (annuity formula)
  • 📊 Year-by-year growth schedule
  • 🔢 Effective annual rate (EAR) computation
  • 🪶 Zero dependencies
  • ✅ Full input validation

Installation

npm install @toolsnap/compound-interest-calculator

Usage

Basic Compound Interest

const { compoundInterest } = require('@toolsnap/compound-interest-calculator');

const result = compoundInterest(10000, 0.06, 10, 12);
// {
//   principal: 10000,
//   totalInterest: 8193.97,
//   totalValue: 18193.97,
//   effectiveRate: 6.1678
// }

With Monthly Contributions

const { withMonthlyContribution } = require('@toolsnap/compound-interest-calculator');

const result = withMonthlyContribution(5000, 200, 0.07, 20);
// {
//   principal: 5000,
//   totalContributions: 53000,
//   totalInterest: 34664.42,
//   totalValue: 87664.42
// }

Effective Annual Rate

const { effectiveAnnualRate } = require('@toolsnap/compound-interest-calculator');

const ear = effectiveAnnualRate(0.05, 12);
// 0.05116... (~5.12%)

Year-by-Year Growth Schedule

const { growthSchedule } = require('@toolsnap/compound-interest-calculator');

const schedule = growthSchedule(10000, 500, 0.06, 5);
// [
//   { year: 1, deposit: 6000, interest: 648.42, balance: 16648.42 },
//   { year: 2, deposit: 6000, interest: 1030.56, balance: 23678.98 },
//   ...
// ]

API

compoundInterest(principal, rate, time, frequency)

Calculate compound interest on a principal amount.

| Parameter | Type | Description | |-------------|--------|------------------------------------------------| | principal | number | Initial investment amount | | rate | number | Annual interest rate (decimal, e.g. 0.05) | | time | number | Time period in years | | frequency | number | Compounding frequency/year (default: 12) |

withMonthlyContribution(principal, monthly, rate, years)

Calculate growth with regular monthly contributions using the annuity formula.

effectiveAnnualRate(nominalRate, frequency)

Convert a nominal rate to the effective annual rate (EAR).

growthSchedule(principal, monthly, rate, years)

Generate a year-by-year breakdown of deposits, interest earned, and balance.

Online Calculator

For a full-featured interactive calculator, visit:

👉 Compound Interest Calculator

Related tools:

License

MIT © ToolSnap