ComputeYard

The math, explained — built by a derivatives quant.

Dollar-Cost Averaging Calculator

Project the outcome of investing a fixed amount each period and compare it against putting the same total in as a single lump sum at the start price.

How it works

Dollar-cost averaging (DCA) means investing a fixed contribution every period — monthly, quarterly, semi-annual or annual. When the price is lower you buy more shares; when it is higher you buy fewer, so your average cost per share reflects every purchase rather than a single entry point.

The share price steps annually: every period within a year buys at the same price, and the price grows by your annual rate at each year boundary. The lump-sum comparison invests the entire total at the start price at t = 0 and rides it to the end, so you can see whether spreading your buys helped or hurt.

Worked example

Invest $120/year (frequency = annual) for 2 years, starting at $100/share with 20% annual price growth:

  • Year 0: price $100 → 120 / 100 = 1.2 shares.
  • Year 1: price $120 → 120 / 120 = 1.0 share. Ending shares = 2.2.
  • Total invested = $240; final price = 100 × 1.2² = $144.
  • Ending value = 2.2 × $144 = $316.80; profit $76.80; total return 32%.
  • Lump sum: $240 / $100 = 2.4 shares → 2.4 × $144 = $345.60.
  • DCA − lump sum = 316.80 − 345.60 = −$28.80.

Here the price rose steadily, so lump-sum won; DCA tends to win when prices fall before recovering, because the cheaper buys lower your average cost.

The formula

periods    = frequency × years
price_y    = start_price × (1 + growth) ^ year      (year = period // frequency)
shares    += contribution / price_y                 (each period)
final_price  = start_price × (1 + growth) ^ years
ending_value = shares × final_price
average_cost = total_invested / shares
lump_value   = (total_invested / start_price) × final_price

FAQ

When does DCA beat a lump sum?
When prices dip and recover during your contribution window, the cheaper buys lower your average cost. In a steadily rising market, investing the lump sum earlier usually wins.
How is the average cost per share calculated?
It is your total invested divided by the total shares acquired across every period — the blended price you effectively paid.
Does it account for price growth?
Yes — set an annual price growth rate. The price steps once per year, so every period within a year buys at that year's price. Leave it at 0 for a flat price.

More calculators