Compound Interest Calculator Formula
Understand the math behind the compound interest calculator. Each variable explained with a worked example.
Formulas Used
Future Value
future_value = monthly_rate > 0 ? principal * pow(1 + monthly_rate, num_months) + monthly_contribution * (pow(1 + monthly_rate, num_months) - 1) / monthly_rate : principal + monthly_contribution * num_monthsTotal Contributions
total_contributions = principal + monthly_contribution * num_monthsTotal Interest Earned
total_interest_earned = future_value - total_contributionsVariables
| Variable | Description | Default |
|---|---|---|
principal | Initial Investment(USD) | 10000 |
monthly_contribution | Monthly Contribution(USD) | 200 |
annual_rate | Annual Interest Rate(%) | 7 |
years | Time Period(years) | 20 |
monthly_rate | Derived value= annual_rate / 12 / 100 | calculated |
num_months | Derived value= years * 12 | calculated |
How It Works
How Compound Interest Works
Compound interest is interest calculated on both the initial principal and the accumulated interest from previous periods.
Formula
FV = P(1+r)^n + PMT * [(1+r)^n - 1] / r
Where:
Worked Example
You invest $10,000 and add $200 per month at 7% annual return for 20 years.
principal = 10000monthly_contribution = 200annual_rate = 7years = 20
- 01Monthly rate: 7% / 12 = 0.5833% (0.005833)
- 02Total months: 20 * 12 = 240
- 03Growth of initial investment: $10,000 * (1.005833)^240 = $40,387.39
- 04Growth of contributions: $200 * [(1.005833)^240 - 1] / 0.005833 = $104,185.06
- 05Future Value = $40,387.39 + $104,185.06 = $144,572.45
- 06Total contributions: $10,000 + ($200 * 240) = $58,000
- 07Total interest earned: $144,572.45 - $58,000 = $86,572.45
Ready to run the numbers?
Open Compound Interest Calculator