Compound Interest Calculator

Compound Interest Calculator API

Finance

See how savings grow with compound interest: a starting amount, regular contributions, any compounding frequency, with a growth chart and a year-by-year table.

Authentication

Send your API key as a Bearer token in the Authorization header (Authorization: Bearer YOUR_API_KEY), or in an X-API-Key header.

Rate Limit

120 requests per minute

Endpoints

1 endpoint available

Overview

Grows a starting amount with optional regular contributions at a fixed annual rate. Returns the final balance, total contributions, total interest, the effective annual rate, the years it takes money to double, and a year-by-year table.

Notes

  • annualRate is a percentage (6 means 6%), from 0 to 100. years is a whole number from 1 to 100.
  • Interest compounds compounding times a year (daily is 365, continuously uses e^rt). Contributions can be on a different schedule. The balance is stepped one contribution period at a time using the exact equivalent rate for that period.
  • contributionTiming start puts each contribution in at the start of its period, so it earns one more period of interest. end is the default.
  • Money in the response is rounded to the cent, so the rounded totals can differ from the exact ones by a cent.
  • yearsToDouble is for the starting amount alone, with no contributions. It is null at a 0% rate.

Endpoints

POST
https://opentools.ca/api/v1/tools/compound-interest-calculator
Calculate compound interest with regular contributions

Request Body

Content-Type: application/json

ParameterTypeRequiredDescription
initialAmount
number
OptionalStarting amount.Default: 0
contribution
number
OptionalAmount added each contribution period.Default: 0
contributionFrequency
string
Enum: weekly, bi-weekly, monthly, quarterly, annually
OptionalHow often contributions are made.Default: monthly
contributionTiming
string
Enum: end, start
OptionalWhether contributions go in at the start or the end of each period.Default: end
annualRate
number
Required
Nominal annual interest rate as a percentage, 0 to 100.
compounding
string
Enum: daily, monthly, quarterly, semi-annually, annually, continuously
OptionalHow often interest compounds.Default: monthly
years
number
Required
Number of whole years, 1 to 100.

Response Example

{
  "success": true,
  "finalBalance": 21800.83,
  "totalContributions": 19000,
  "totalInterest": 2800.83,
  "effectiveAnnualRate": 6.167781,
  "yearsToDouble": 11.5813,
  "yearly": [
    {
      "year": 1,
      "contributions": 3000,
      "interest": 700.67,
      "totalContributions": 13000,
      "totalInterest": 700.67,
      "balance": 13700.67
    },
    {
      "year": 2,
      "contributions": 3000,
      "interest": 928.92,
      "totalContributions": 16000,
      "totalInterest": 1629.59,
      "balance": 17629.59
    },
    {
      "year": 3,
      "contributions": 3000,
      "interest": 1171.24,
      "totalContributions": 19000,
      "totalInterest": 2800.83,
      "balance": 21800.83
    }
  ]
}

Error Codes

400
Bad Request - A field is missing or invalid. The response lists each problem.
401
Unauthorized - Missing or invalid API key
403
Forbidden - The API key is inactive or expired, or the request IP is not allowed
405
Method Not Allowed - This endpoint accepts POST only
429
Too Many Requests - Rate limit exceeded (120 requests per minute per API key)
500
Internal Server Error

Code Examples

# Savings over three years
curl -X POST https://opentools.ca/api/v1/tools/compound-interest-calculator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "initialAmount": 10000,
  "contribution": 250,
  "contributionFrequency": "monthly",
  "annualRate": 6,
  "compounding": "monthly",
  "years": 3
}'

Ready to get started?

Create an API key to start using the Compound Interest Calculator API.

Rather use it in your browser? Open the Compound Interest Calculator