Compound interest: the complete guide
Everything you need to know about compound interest: the formula, why floating-point breaks it, the rule of 72, after-tax and after-inflation math, and how to actually use it across savings, debt, and retirement.
Compound interest is often called the eighth wonder of the world. The Einstein attribution is apocryphal, but the math is real and the consequences are larger than most people instinctively expect. Money that earns interest on both principal and accumulated interest grows in a curve that looks linear for the first few years and then bends sharply upward. By year thirty, the difference between simple interest and compound interest on the same starting capital is usually more than the original principal itself.
This guide is the deep-dive reference. We walk through the formula, the variants you actually meet in practice (monthly contributions, taxes, inflation), the mental shortcuts that work and the ones that lie, the failure modes of doing this math in regular floating-point code, and the three or four places in personal finance where the result genuinely matters. Every number we cite is reproducible in our compound interest calculator, you can copy the inputs from a worked example and confirm the output to the cent.
The two-sentence definition
Simple interest pays you a fixed percentage of the original principal every period, forever. Put $10,000 into a simple-interest account at 5% per year and you earn exactly $500 every year, no more no less. After thirty years you have $25,000.
Compound interest pays you a percentage of the principal plus every dollar of interest that was added in earlier periods. Same $10,000 at 5% compounded annually earns $500 in year one, then $525 in year two (5% of $10,500), $551.25 in year three, and so on. After thirty years you have roughly $43,219. More than half of that final number, about $18,219, is interest earned on previously-earned interest.
The first chart you should burn into memory is the gap. In year one it is $0. In year five it is about $763. In year ten it is about $3,000. In year thirty it is over $18,000. Compound interest looks slow until it does not, and the people who get the best of it are not the people who pick the highest rate. They are the people who got started a decade earlier than everyone else.
The formula in detail
The textbook formula for compound interest is A = P(1 + r/n)^(nt). A is the final amount, P is the principal, r is the annual interest rate as a decimal, n is the number of compounding periods per year, and t is the number of years. The exponent nt is just total compounding periods.
Most consumer products compound monthly (n = 12), so a 5% APY in marketing copy translates to (1 + 0.05/12)^12 ≈ 1.05116 in the formula. The effective annual yield ends up slightly above the stated rate. This gap between APR (the simple annualised rate) and APY (the effective compounded yield) is small at 5% but grows fast. At 20% APR compounded daily, the APY is 22.13%, the difference between the headline number and the cost you actually pay.
Continuous compounding takes the limit as n goes to infinity, giving A = Pe^(rt). It is mostly an academic curiosity for personal finance — the gap between continuous and monthly compounding at consumer rates is in the third decimal place, but it is the version you see in fixed-income models and option pricing.
Adding contributions: the version most people actually need
The single-deposit version above is useful for one-off lump sums. The version that matters for retirement and long-term savings adds a recurring contribution. The closed-form formula for an annuity due (contributions at the start of each period) is FV = P(1 + r/n)^(nt) + PMT × [((1 + r/n)^(nt) - 1) / (r/n)] × (1 + r/n).
Translation: take the formula we already have for the lump sum, then add a second term for the future value of all the periodic contributions, each one growing for fewer and fewer compounding periods as you get closer to the end. The expression looks intimidating but the calculator does it in microseconds. The intuition is simpler: a contribution made in year one has thirty years to compound; a contribution in year twenty-nine only has one. The total is dominated by the early contributions, which is why the time horizon matters so much.
Worked example. Start with $10,000, contribute $500 a month, 7% annual return compounded monthly, 30 years. The lump sum component grows to roughly $81,165. The contribution stream grows to roughly $612,438. Total: about $693,603, of which only $190,000 came from your wallet ($10,000 starting plus $500 × 360 months). Everything else is compounding doing its job.
The rule of 72 (and when it lies)
The fastest mental shortcut is the rule of 72: at r% per year, money doubles in about 72/r years. At 6% it doubles in 12 years; at 8% it doubles in 9; at 12% it doubles in 6. The rule comes from a Taylor expansion of the doubling time formula and is exact only for one specific rate (around 7.85%), but it is good to within half a year for the entire range that matters in personal finance.
The rule lies in three places. It assumes annual compounding, so for monthly compounding the actual doubling time is slightly faster, use 70 instead of 72 if you want to be marginally more accurate. It is wrong by a meaningful amount above 20% per year, where you should switch to actually computing log(2)/log(1+r). And it is silently misleading if you forget that the rate has to be the real (after-inflation, after-tax) rate, not the headline rate. If your investment earns 8% nominal but inflation is 3%, your real doubling time is 72/5 = 14.4 years, not 9.
After tax and after inflation: the rate you actually live on
The number that gets quoted in marketing copy is the gross nominal return, what the money earned before any deductions. The number that determines your standard of living is the real after-tax return: gross return minus taxes minus inflation.
Taxes vary by account type. A taxable brokerage account in the US pays long-term capital gains rates (0%, 15%, or 20%) on growth at sale, plus ordinary-income rates on dividends and interest as they happen. A traditional 401(k) defers all of it but converts everything into ordinary income at withdrawal. A Roth IRA, paid for with already-taxed money, gives the cleanest version: gross return = real return at the tax level. Pick the right account first, optimise the rate second.
Inflation grinds at 2-3% in normal periods and spikes higher in shocks. The Federal Reserve targets 2% on the PCE deflator. If you are projecting 30 years out, your nominal 7% expected return is more like 4-5% real. The Trinity Study and the original 4% rule were built on real returns, not nominal, get this distinction wrong and you will withdraw too much.
A useful exercise: take the headline rate, subtract your marginal tax rate on the gain (long-term cap gains for taxable accounts, ordinary for traditional retirement at withdrawal), then subtract 2.5%. If the resulting number is below 1%, the investment is not really growing in any meaningful sense — it is treading water. This is the test that exposes most "high-yield" savings accounts at consumer banks.
Why decimal math matters here
JavaScript and most programming languages use IEEE 754 binary floating-point by default. The number 0.1 cannot be represented exactly in binary, so 0.1 + 0.2 produces 0.30000000000000004 instead of 0.3. Over a single calculation this is invisible. Over 360 monthly compounding steps over 30 years, the accumulated error in a naive implementation is real cents, sometimes dollars at large balances.
On the QuickUse compound interest calculator we use decimal.js, an arbitrary-precision decimal library. Every monthly compounding step is computed in decimal and the result is rounded only at presentation time. This is not paranoia; it is the same reason every accounting system in the world uses fixed-point or arbitrary-precision arithmetic for money. The Vancouver Stock Exchange index famously drifted by hundreds of points over a few years from rounding errors in the late 1980s. Bank reconciliation tools have whole categories of bug born of float imprecision. We just refuse to inherit that.
For a more readable version of the same point: if you are evaluating someone else's calculator and you get a different answer to the third decimal place, the calculator is probably using floats. That is usually fine for an order-of-magnitude estimate. It is not fine if you are using the output to size a contribution or plan a withdrawal.
Where it shows up in real life
Retirement accounts. A 401(k) or IRA with a 7% expected real return roughly doubles every ten years. Someone who starts contributing $500/month at age 25 lands at retirement (age 65) with about $1.3 million in a 7% real-return scenario. Same person starting at age 35: about $610,000. Same person starting at age 45: about $260,000. Compound interest rewards starting early at a far steeper rate than most starting-late strategies can compensate for.
Credit card debt. The same math runs in reverse for revolving debt. A $5,000 balance at 24% APR compounded daily, paying only the minimum (typically 2% of balance), takes over 25 years to pay off and costs more than $13,000 in interest. The compounding side of credit cards is the thing that locks people into a balance for decades.
Mortgages. A 30-year fixed mortgage compounds in your favour structurally, early payments are mostly interest, late payments are mostly principal, and any extra principal payment pulls the entire amortisation schedule forward. Pay an extra $200/month on a $300,000 mortgage at 6.5% and you save roughly $90,000 in interest and finish about six years early.
Student loans. US federal loans accrue daily interest and capitalise periodically (during deferment, forbearance, or income-driven repayment recalculations). The capitalisation event resets the principal upward, and from then on the interest grows on a larger base. Borrowers who do not understand this mechanic often discover, ten years in, that their balance is higher than the day they graduated despite years of payments.
High-yield savings accounts. Yields are typically quoted as APY, which already bakes in the compounding. A 4.5% APY on a $20,000 balance earns about $920 in the first year. After tax (federal + state, say 30%) and inflation (2.5%), real return is closer to 0.5%, which is positive, but not the wealth-builder the marketing implies.
Common mistakes
Conflating APR and APY. APR is the simple annualised rate; APY includes compounding. For consumer comparison shopping, APY is what you actually earn or pay.
Forgetting the contribution timing. An annuity due (contribution at the start of the period) finishes slightly higher than an annuity ordinary (contribution at the end), because each contribution gets one extra period to compound. The difference is small but real, about 7% extra at 7% annual return over 30 years.
Picking the wrong rate. The historical S&P 500 nominal return is around 10% per year. The real (inflation-adjusted) return is around 7%. The after-tax real return in a taxable account is around 5%. Different planning questions take different numbers; they are not interchangeable.
Compounding-frequency theater. The difference between monthly and daily compounding at consumer rates is usually less than 0.05% APY. Anyone advertising a product on the basis of "daily compounding" is selling you a feature that does not move the result meaningfully. Look at APY, not compounding frequency.
Tools we built around this
The compound interest calculator does the basic math with monthly contributions, decimal precision, and a year-by-year breakdown of principal versus interest. The FIRE calculator extends it to a withdrawal phase using the 4% rule and a configurable safe withdrawal rate. The retirement calculator (US) layers on 401(k) contribution limits, employer match, and Roth-vs-traditional tax math, all using the same decimal-precision compounding engine. The loan calculator runs the same math in reverse: instead of growing a balance with contributions, it amortises a balance with payments.
Each of those tools has its own page with worked examples and the formula written out. They share the same engine, which means a $1 input on the compound interest calculator produces the same final number as the equivalent input on FIRE or retirement — there is one source of truth for the math.
Try the calculator
Calculators mentioned in this post:
Compound Interest
Calculate compound interest with monthly contributions. See how your money grows over time.
FIRE Calculator
Find out when you can retire early. Calculate your FIRE number, time to financial independence, and compare Lean, Regular, Fat, Coast and Barista FIRE scenarios.
Loan Calculator
Monthly payment, total interest and amortization schedule for personal, auto, or consumer loans.
Retirement Calculator 2026: 401(k), IRA, Roth + SECURE 2.0
Plan retirement with 2026 IRS limits ($24,500 401(k), $7,500 IRA, $11,250 super catch-up 60-63), employer match modeling with vesting, Roth vs Traditional bracket arbitrage, SECURE 2.0 Roth catch-up rule, and 30-year projection with inflation.
Frequently asked questions
How is compound interest different from simple interest?
Simple interest pays a fixed percentage of the original principal every period. Compound interest pays a percentage of the principal plus all the interest already earned. Over a year or two the difference is small. Over thirty years it is usually larger than the original principal itself.
What is the rule of 72?
A mental shortcut: at r% per year, money doubles in about 72/r years. At 6% it doubles in 12 years, at 8% in 9, at 12% in 6. The rule is good to within half a year across the range of rates that matter in personal finance, but use the real (after-tax, after-inflation) rate, not the headline number.
Does compounding frequency really matter?
Less than marketing copy implies. The difference between monthly and daily compounding at typical consumer rates is usually below 0.05% APY. Look at the APY, not the compounding frequency, when comparing products.
What rate should I use for retirement projections?
A common starting point is 7% nominal or 5% real for a stocks-heavy portfolio over a 30-year horizon, based on long-run S&P 500 history. More conservative planners use 5% nominal / 3% real. The right number depends on your asset allocation and how much margin of safety you want; running the calculator at two or three different rates is a healthier exercise than picking one.
Is compound interest taxed every year?
Depends on the account. Taxable brokerage accounts are taxed on dividends and interest as they happen, and on capital gains at sale. Traditional IRA/401(k) defers all of it, taxed as ordinary income at withdrawal. Roth IRA, paid with after-tax money, has no further tax on the growth. The tax shelter on retirement accounts is what makes the long-term math work for most people.
How does inflation factor in?
A 7% nominal return at 3% inflation is a 4% real return, roughly. The exact formula is (1+nominal)/(1+inflation) - 1, which gives 3.88% in this example. For long-horizon planning use the real rate, not the nominal one. Otherwise you will be projecting purchasing power that does not exist.
Why does QuickUse use decimal precision instead of regular floats?
IEEE 754 floating-point arithmetic accumulates small errors that compound (literally) over many iterations. Over 360 monthly compounding steps in a 30-year projection, naive float math can drift by real cents. We use the decimal.js library so the math is exact to the precision the user asks for. It is the same reason every accounting system uses fixed-point arithmetic.

