Code tool

Dollar Cost Averaging Calculator

Build a complete dated investment ledger from your own prices, contributions, fees and cash dividends.

In-browser processingNo account requiredPrivacy details ↗

One row: YYYY-MM-DD, price, contribution, fee, optional cash dividend. No header. Dates must be chronological; repeated dates are allowed. In equal mode leave the contribution column empty; every row uses the fixed amount. Decimal and scientific notation are accepted. Resource limits: 250000 characters across all inputs; each exact numerator and denominator at most20000 digits (including powers from exponents). All money uses your currency; prices are per share.

Each purchase uses only its row contribution less its fee. Whole shares use exact floor; fractional shares use exact division. Remainders and cash dividends stay separate and are never reinvested automatically. Acquisition cost includes fees but excludes retained cash and dividends. Value = shares × final price + remainders + cash dividends; gain = value − contributions; return = 100 × gain / contributions. All outputs are exact integers, decimals or reduced fractions; no rounded approximation is used. Equal portions at regular intervals describe dollar cost averaging; variable amounts or irregular dates are a user transaction ledger. No price history is fetched and this is not investment advice.

Inputs and results stay in this browser.

A QUICK WALKTHROUGH

How to use this tool

  1. One row: YYYY-MM-DD, price, contribution, fee, optional cash dividend. No header. Dates must be chronological; repeated dates are allowed. In equal mode leave the contribution column empty; every row uses the fixed amount. Decimal and scientific notation are accepted. Resource limits: 250000 characters across all inputs; each exact numerator and denominator at most20000 digits (including powers from exponents). All money uses your currency; prices are per share.
  2. Each purchase uses only its row contribution less its fee. Whole shares use exact floor; fractional shares use exact division. Remainders and cash dividends stay separate and are never reinvested automatically. Acquisition cost includes fees but excludes retained cash and dividends. Value = shares × final price + remainders + cash dividends; gain = value − contributions; return = 100 × gain / contributions. All outputs are exact integers, decimals or reduced fractions; no rounded approximation is used. Equal portions at regular intervals describe dollar cost averaging; variable amounts or irregular dates are a user transaction ledger. No price history is fetched and this is not investment advice.

Model and units

Each purchase uses only its row contribution less its fee. Whole shares use exact floor; fractional shares use exact division. Remainders and cash dividends stay separate and are never reinvested automatically. Acquisition cost includes fees but excludes retained cash and dividends. Value = shares × final price + remainders + cash dividends; gain = value − contributions; return = 100 × gain / contributions. All outputs are exact integers, decimals or reduced fractions; no rounded approximation is used. Equal portions at regular intervals describe dollar cost averaging; variable amounts or irregular dates are a user transaction ledger. No price history is fetched and this is not investment advice. https://www.investor.gov/introduction-investing/investing-basics/glossary/dollar-cost-averaging

Transaction ledger

One row: YYYY-MM-DD, price, contribution, fee, optional cash dividend. No header. Dates must be chronological; repeated dates are allowed. In equal mode leave the contribution column empty; every row uses the fixed amount. Decimal and scientific notation are accepted. Resource limits: 250000 characters across all inputs; each exact numerator and denominator at most20000 digits (including powers from exponents). All money uses your currency; prices are per share.

Complete report

Inputs and results stay in this browser.

GOOD TO KNOW

Common questions

Are remaining cash and dividends invested again?

No. They remain cash. Enter a separate explicit contribution transaction to represent another purchase; avoid counting the same external contribution twice. This ledger has no withdrawals, taxes or automatic reinvestment.