Skip to content

othmarodev/compound-interest-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Compound Interest Calculator

A clean, dependency-free compound interest calculator
with monthly deposits, custom canvas chart, and ES/EN toggle.

Live demo

Zero deps Single file Mobile first MIT


✦ What it does

Simulates the growth of an initial balance with monthly contributions at a fixed monthly return rate. Updates everything in real time as you type:

  • 💰 Final balance — what you end with
  • 📥 Capital invested — your money in (initial + monthly deposits × months)
  • 📈 Interest earned — finalBalance − invested
  • 🎯 Total return % — interest / invested
  • 📊 Bar chart — monthly balance growth, custom canvas (no Chart.js)
  • 📋 Detailed table — month-by-month breakdown with running totals

✦ Try it

Live demo on GitHub Pages

Or clone and open index.html in any browser. Zero build step.

git clone https://github.com/othmarodev/compound-interest-calculator.git
cd compound-interest-calculator
open index.html

✦ The math

For each month m from 1 to N:

gain[m]   = balance[m-1] × (rate / 100)
balance[m] = balance[m-1] + gain[m] + deposit

Where:

  • rate is the monthly return (not annual)
  • deposit is applied after each month's gain
  • All values are USD-rounded to 2 decimals in the UI

For an annual rate, divide by 12 before entering. For example, an annual 12% becomes a monthly 1%.

✦ Tech

  • Pure vanilla — HTML + CSS + JS, all in a single 600-line index.html
  • No dependencies — no npm, no build, no framework
  • Custom canvas chart — gradient bars + dynamic Y-axis labels (no Chart.js)
  • Mobile-first — responsive grid down to 360px
  • Bilingual — ES / EN toggle with full UI translation
  • Accessibility — semantic HTML, ARIA roles on language toggle

✦ Browser support

Everything ES2018+. Tested on Chrome, Safari, Firefox, Edge. Works on iOS Safari and Chrome mobile.

✦ Origin

Originally part of fallaox.com — an automated trading platform — where investors use it to simulate strategy returns. Extracted as a standalone open-source tool because the math doesn't belong to anyone, and a clean compound-interest calculator is something everyone needs eventually.

✦ License

MIT — see LICENSE. Use it, fork it, embed it, ship it.


Made with code, curiosity, and ☕ — from 🇨🇷 San José, Costa Rica · by Othmaro Fallas

About

A clean, dependency-free compound interest calculator with monthly deposits, custom canvas chart, and ES/EN toggle. Single-file HTML.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages