The formula
Units bought each time = (amount − fee) ÷ price
Total units = sum of units bought
Average cost = total invested ÷ total units
Current value = total units × current price
Gain = current value − total invested
Lump sum comparison: (total invested − fee) ÷ first price × current price
Worked example
- Invest $500 at each of 12 prices: 50, 45, 40, 38, 42, 47, 52, 55, 53, 58, 60 and 62.
- You buy 10 units at $50, 11.11 at $45, 12.5 at $40, and so on: 122.47 units for $6,000.
- Average cost = 6,000 ÷ 122.47 = $48.99, below the simple average price of $50.17.
- At $62, the units are worth $7,593.19, a gain of $1,593.19 (26.55%).
- Investing all $6,000 at the first price ($50) would have bought 120 units, now worth $7,440.
How dollar-cost averaging works
Dollar-cost averaging (DCA) means investing a fixed amount at regular intervals, such as monthly, regardless of the price. When prices are low your money buys more units; when prices are high it buys fewer. As a result your average cost per unit is always at or below the simple average of the prices you paid. It's a harmonic mean rather than an arithmetic one. Monthly investing from a paycheque, through a 401(k), an Indian SIP or a regular ISA contribution, is DCA in practice.
DCA vs lump sum
If you already have a lump sum, the research is clear on averages: because markets rise more often than they fall, investing everything at once has beaten spreading it out roughly two-thirds of the time historically. DCA wins when prices fall after you start, as they did in the first months of the example. Its real value is behavioural. It reduces the regret of investing everything just before a drop, and it makes investing automatic. Many people split the difference by investing a large share immediately and the rest over a few months.
Using the calculator
Enter the amount you invest each time and a list of prices, oldest first, separated by commas. You might use monthly closing prices of a fund, a stock or a cryptocurrency, copied from a spreadsheet. The table shows each purchase and how your average cost changes over time. Set the current price to today's price to see your gain or loss, and add a per-purchase fee if your broker charges one. Fixed fees hurt small, frequent purchases most.
DCA in volatile markets
DCA is popular for volatile assets like individual stocks and cryptocurrencies, because large price swings mean more units bought on the dips. Volatility doesn't create returns on its own, though. If an asset falls and never recovers, DCA just spreads your losses across more purchases. It works best with diversified investments that you expect to grow over the long term, such as broad index funds, held through the ups and downs.
Tracking cost basis
Each purchase is a separate tax lot with its own cost. When you sell, many countries let you choose (or require) a method: FIFO (first in, first out), specific identification or average cost. UK investors pool shares at average cost under section 104 rules, and US mutual funds often default to average cost. The average cost shown here matches the pooled method. For a gain estimate, try our capital gains tax calculator.
Example: what the numbers show
In the default example, prices fall from $50 to $38 over the first four months before recovering to $62. The cheap months bought the most units: $500 at $38 bought 13.16 units, compared with 8.06 units at $62. That's why the average cost ($48.99) ends up below the simple average price ($50.17), and why DCA beat a lump sum here. If prices had risen steadily from the first purchase, the lump sum would have won.
Related calculators
For a fixed monthly amount at a steady expected return, see the SIP calculator. If you've bought a stock at a few different prices, the average down calculator works out your break-even price and the shares needed to reach a target average. For long-term growth projections, try the compound interest calculator.