Build a compound interest calculator that shows growth year by year
A good compound interest calculator does more than print one final number. It shows how much of the end balance came from the saver's own deposits and how much from interest, year by year, so the effect of time is obvious. Anticode can build one as an interactive chart for a blog, a savings guide or a finance education site, labelled honestly as an illustration rather than a forecast.
The inputs people expect
- Starting amount
- What's already saved. Zero must be allowed.
- Regular contribution
- An amount added monthly or yearly, with a choice of when: start or end of each period. The timing changes the result slightly, and careful readers notice.
- Annual rate
- Entered as a percentage. Allow decimals and negative values for people modelling a bad year.
- Compounding frequency
- Yearly, quarterly, monthly or daily. Monthly is a sensible default for savings accounts.
- Term
- Years, and ideally months too.
- Optional extras
- Annual increase in contributions, inflation to show real values, and a target amount to solve for time.
Keep the extras behind an "Advanced" toggle. Most visitors want to change two numbers and watch the chart move; a wall of fields loses them.
The calculation and its edge cases
With compounding n times a year at annual rate r, a balance grows by a factor of (1 + r/n) each period. Regular contributions are cleanest to compute period by period in a loop rather than with the closed-form annuity formula, because a loop handles contribution and compounding frequencies that don't match, yearly step-ups and one-off withdrawals without special cases.
- Zero rate. The closed-form formula divides by the rate; a loop simply adds deposits.
- Very long terms. Fifty years at a high rate produces large numbers; format them with thousands separators and never in scientific notation.
- Rounding. Keep full precision internally and round only for display, or the year-by-year table won't add up to the total.
- Inflation. If included, show both nominal and real values, labelled, rather than silently replacing one with the other.
The chart is the point
A stacked bar or area chart per year, with contributions in one colour and accumulated interest in another, does the teaching for you: in early years the interest band is a sliver, and later it overtakes the deposits. Under the chart, a table of year, total deposited, interest earned that year and closing balance lets people check the numbers. A savings goal calculator mode turns the question round: given a target and a monthly amount, how many years? Or given a target and a date, how much each month?
The model draws charts in code (SVG or canvas), since apps can't load outside chart libraries. That keeps the page light and the chart styled to match the rest of the site.
Describing it to Anticode
"An investment growth calculator for a personal finance blog. Starting amount, monthly contribution, annual rate, compounding frequency and years. Stacked bar chart of deposits versus interest per year, a table below, and a toggle to show values after 2.5% inflation. A note under the result saying it's an illustration with a fixed rate, not a forecast or advice. Editorial design, one accent colour."
If the calculator sits within a wider finance site, the retirement calculator, debt payoff calculator and budget tracker are natural companions. Nothing a visitor types is sent anywhere: the calculation runs in their browser.
What to say and what it can't do
Real returns vary from year to year, fees reduce them, and tax treatment depends on the account and the country. A calculator with one fixed rate can't show any of that, and it shouldn't imply it does. Put a short, visible note beside the result. If you are a regulated firm, your compliance team will have its own wording for financial promotions; use theirs.
- No live rates. The app can't fetch current savings or market rates; the visitor or you type them in.
- No account linking. It can't read a real balance from a bank or broker.
- No personalised advice. It computes what it's given. Don't present it as a recommendation.
- Nothing saved by default. Ask for the last inputs to be remembered on the device if visitors return often.
Questions people ask
What's the difference between a compound interest calculator and a savings calculator?
Mostly naming. A savings calculator usually emphasises regular deposits and a goal; a compound interest calculator emphasises the rate and compounding. One app can do both.
Can it model variable returns?
You can ask for a simple range, such as showing results at a low, middle and high rate side by side. That communicates uncertainty better than one line.
Can visitors email themselves the result?
The app can't send email to visitors. It can offer a printable summary, and a contact form can reach you if they want to talk.