What dollar-cost averaging actually computes
Dollar-cost averaging means committing a fixed amount of money at fixed intervals instead of buying a fixed number of shares. That single choice changes the arithmetic of your cost basis. When you spend $500 a month, a month where the price is low buys you more shares than a month where the price is high, so the cheap purchases carry more weight in your final average than the expensive ones do.
The number this calculator returns as its headline is your average cost per share: every dollar you committed divided by every share you ended up holding. That figure is what your broker reports as cost basis, what your capital-gains tax is measured against when you sell, and the break-even price below which the position shows a paper loss.
Three things fall out of the same schedule and are reported alongside it. Total shares tells you the size of the position. Position value marks it to the current price. And the arithmetic average price — the plain mean of the prices you typed — is shown next to your average cost so you can see the gap between them. That gap is the entire mathematical content of dollar-cost averaging, and on a commission-free account it is never negative.
The calculator does not care what the asset is. A monthly index-fund purchase, a weekly bitcoin buy and a quarterly employee share-purchase plan all use the same formula. Only the price list changes.
Why your average cost is a harmonic mean
Start from the definition. At purchase k you spend C dollars at price Pk, so you receive C ÷ Pk shares. After n purchases you hold Σ(C ÷ Pk) shares and have spent n × C dollars. Divide the second by the first:
Average cost = nC / Σ(C/P_k)
The constant C cancels top and bottom, leaving n / Σ(1/P_k). That expression is the textbook definition of the harmonic mean — the reciprocal of the average of the reciprocals. It is the mean you use whenever the quantity you hold fixed sits in the denominator: average speed over equal distances, average price-to-earnings ratio across an index, and average cost when you fix the dollars rather than the units.
The harmonic mean of a set of positive numbers is never greater than their arithmetic mean, and the two are equal only when every number is identical. That inequality is the whole claim behind cost averaging: with a fixed dollar amount and no fees, your average cost lands at or below the average price you saw, and the more the prices scatter, the wider the gap.
Notice what the inequality does not say. It says nothing about whether you made money — your return depends on where the price finished, not on how your cost compares with the mean. It says nothing about whether averaging in beat investing everything on day one. And it collapses to nothing at all if prices never move. It is an arithmetic identity about weighting, not a forecast.
Commissions break the symmetry. If a flat fee f is deducted before the purchase, only C − f buys shares while the full C stays in your cost basis, so the average cost rises above the harmonic mean and can exceed the arithmetic mean price outright. The calculator reports that case explicitly rather than pretending the inequality still holds.
Worked example: $1,000 a month at $8.00, $10.00 and $12.50
You invest $1,000 into the same fund on three consecutive months. The price is $8.00, then $10.00, then $12.50. There is no commission.
- Shares from the first purchase. $1,000 ÷ $8.00 = 125.000 shares.
- Shares from the second. $1,000 ÷ $10.00 = 100.000 shares.
- Shares from the third. $1,000 ÷ $12.50 = 80.000 shares.
- Total shares. 125 + 100 + 80 = 305.000 shares.
- Total cash committed. 3 × $1,000 = $3,000.
- Average cost per share. $3,000 ÷ 305 = $9.8361.
- Arithmetic average price. ($8.00 + $10.00 + $12.50) ÷ 3 = $30.50 ÷ 3 = $10.1667.
- The gap. $10.1667 − $9.8361 = $0.3306 per share, about 3.3% of the mean price.
- Position value at $12.50. 305 × $12.50 = $3,812.50.
- Gain. $3,812.50 − $3,000 = $812.50, or 812.50 ÷ 3,000 = 27.08% on the cash invested.
Now run the alternative to see where the $0.33 came from. Suppose you had bought 100 shares each month instead of spending $1,000 each month. You would have paid 100 × ($8.00 + $10.00 + $12.50) = $3,050 for 300 shares, an average of exactly $10.1667 — the arithmetic mean. Fixing the dollars instead of the shares got you five more shares for $50 less. That is the mechanism, stated in full: nothing about market timing, only about which quantity you held constant.
Check the harmonic-mean formula directly as a cross-check: 3 ÷ (1/8 + 1/10 + 1/12.5) = 3 ÷ (0.125 + 0.100 + 0.080) = 3 ÷ 0.305 = $9.8361. It agrees, as it must.
How to read your average cost
Read the average cost first as a break-even line. If the current price is above it, the position is in profit before tax and any dividends; below it, at a paper loss. It is also the number a tax authority will start from when you sell, so it is worth reconciling against your broker's own cost-basis figure — brokers include commissions and, in many jurisdictions, adjust for reinvested distributions, which this calculator does not do unless you enter those purchases as extra rows.
Read the gap between average cost and average price second, and read it modestly. It is a second-order effect. For prices scattered within a few percent of each other the gap is a fraction of a percent; it only becomes material when the price roughly halves or doubles across your buying window. The reference table below quantifies that directly, and the pattern it shows is worth internalising: the gap grows with the square of the dispersion, not with the dispersion itself, which is why it is near-invisible in calm markets and conspicuous in violent ones.
Read the return figure third, and read it as a return on cash committed, not as an annualised rate. Because your money went in over time, only the first contribution was exposed for the whole period. A 27% gain on cash invested over three months is not a 27% quarterly return on capital, and comparing it with a fund's published performance is comparing two different things. When you need the annualised figure for a stream of contributions, use a money-weighted measure — the money-weighted return calculator — or, for a single lump with a start and end value, the CAGR calculator.
Finally, sanity-check the schedule table. If one row shows a share count wildly out of line with its neighbours, you almost certainly mistyped a price or let a thousands separator split a number in two.
How far below the mean price your cost lands
| Second price | Arithmetic mean price | Your average cost | Gap per share | Gap as % of mean |
|---|---|---|---|---|
| $50.00 | $75.00 | $66.67 | $8.33 | 11.1% |
| $70.00 | $85.00 | $82.35 | $2.65 | 3.1% |
| $90.00 | $95.00 | $94.74 | $0.26 | 0.28% |
| $100.00 | $100.00 | $100.00 | $0.00 | 0.0% |
| $110.00 | $105.00 | $104.76 | $0.24 | 0.23% |
| $130.00 | $115.00 | $113.04 | $1.96 | 1.70% |
| $150.00 | $125.00 | $120.00 | $5.00 | 4.0% |
| $200.00 | $150.00 | $133.33 | $16.67 | 11.1% |
A 10% move either way buys you about a quarter of a percent. A halving or a doubling buys you eleven percent. The averaging benefit is real but small until volatility is large.
A lower average cost is not the same as a higher return
The harmonic-mean inequality guarantees that your cost basis lands at or below the mean of the prices you paid. It guarantees nothing about profit. A position bought entirely through falling prices will show a very attractive cost advantage and a large loss at the same time, because the cost advantage is measured against the prices you saw and the loss is measured against the price today. Read the two figures separately; they answer different questions.
Mistakes and assumptions that change the answer
- Leaving out fees. Enter the commission if your broker charges one. Fees enter the cost basis but not the price list, so omitting them makes your average cost look lower than the one on your statement.
- Ignoring reinvested dividends. Each reinvestment is a purchase at that day's price and belongs in the list. Leaving it out understates both your share count and your cost basis. The DRIP calculator handles the compounding version of this directly.
- Assuming whole shares. The schedule allows fractional shares. If your broker rounds down and returns the remainder as cash, your real share count will be slightly lower and your average cost slightly different.
- Using closing prices when you bought intraday. For volatile assets the execution price can sit well away from the close. Use fills from your trade confirmations, not chart values.
- Mixing currencies. Every price must be in the same currency as the contribution. Convert first if you bought a foreign-listed line.
- Typing thousands separators. A price entered as
1,250.00is read as two prices, 1 and 250. Write1250. - Treating the return figure as annualised. It is a simple return on total cash committed and takes no account of when each dollar went in.
Averaging in versus investing it all at once
Two quite different questions get filed under “dollar-cost averaging”, and confusing them causes most of the argument about it.
The first is the one this calculator answers: given that money arrives from a salary in monthly slices, what does the resulting cost basis look like? Here averaging is not a strategy at all, it is a description of your cash flow. You cannot invest a January salary in the previous June. The harmonic-mean result is simply the arithmetic of that constraint, and it happens to be mildly favourable.
The second is a genuine choice: you already hold a lump sum in cash — should you invest it now or spread it over the next twelve months? That is a risk question, not an arithmetic one. Spreading it keeps part of the money out of the market for part of the period, which cuts the damage from an immediate fall and equally cuts the gain from an immediate rise. Since equity markets have risen over most long historical windows, holding back tends to cost expected return in exchange for a narrower range of short-run outcomes. If that trade buys you the discipline to actually invest, it is worth paying for; if it is a way of postponing a decision, it is not.
Once the money is in, the maintenance question becomes allocation rather than entry price, which is the province of the portfolio rebalancing calculator. If you are budgeting the contribution itself, work backwards from the goal with the monthly investment needed calculator, or project a fixed monthly plan forward with the SIP calculator. And if you are averaging down deliberately into an existing losing position rather than on a schedule, the stock average down calculator frames it as a single blended-basis decision instead of a series. Over long horizons the fee you pay each year will move your outcome more than the entry price ever did — the expense ratio drag calculator puts a number on that.
Key terms
- Cost basis
- The total amount you are treated as having paid for a holding, including commissions. Gains and losses are measured from it, and it transfers to any shares you keep when you sell part of a position.
- Harmonic mean
- The reciprocal of the mean of the reciprocals: n ÷ Σ(1/x). It is the correct average whenever the fixed quantity sits in the denominator, and it is never larger than the arithmetic mean of the same positive numbers.
- Fractional share
- A holding of less than one whole share, created when a broker splits a fixed dollar purchase across the price. Most retail brokers now support them; some still round down and return the remainder as cash.
- Mark to market
- Valuing a holding at the current price rather than at what you paid. The Position value output is a mark-to-market figure.
