Average share cost calculator for several purchases

List what you bought, share by share and price by price, with the commission of each purchase. The page gives the total shares, the total cost and the average cost per share, then what the shares are worth now and how many more you would need at a new price to pull the average to a figure you pick.

How many shares this purchase bought. Fractions are allowed, to 6 decimal places. Leave the row empty if you made no such purchase.
$
What one share cost in this purchase, before any commission, up to 4 decimals.
$
Whatever the broker charged on this purchase, commission included, in whole cents. Leave it blank for no charge.
$
What one share is worth now, up to 4 decimals. Leave it blank to see only the cost; enter 0 if the position lost all its value.

Result

Summary

Average cost per share

$38.3485 per share

Total shares
100
Total cost
$3,834.85
Market value now
$3,840.00
Gain or loss on paper
$5.15
Return on the cost
0.13%
Shares to buy
79.93
Cost of that purchase
$2,642.75
Average after buying
$36.00 per share

The arithmetic of one holding built in up to five purchases. It picks no tax method, follows no sale or split, taxes nothing, and never says whether to buy or sell.

Three purchases at falling prices: an average of $38.3485

50 shares at $42.00 with a $4.95 commission cost $2,104.95; 30 at $36.50 cost $1,099.95; 20 at $31.25 cost $629.95. Together that is 100 shares for $3,834.85, so each share cost $38.3485 on average. Leave the three commissions out and the average would read $38.2000, $0.1485 less.

At $38.40 a share the holding is worth $3,840.00, which is $5.15 above what it cost, a return of 0.13% on paper. Nothing is realized until the shares are sold.

To pull the average down to $36.00 by buying at $33.00 with a $4.95 commission, the page finds 79.933334 more shares, a purchase of $2,642.75; with them the average is $36.0000. The fraction of a share is rounded up, so the target is reached and never missed.

Now the average in the other direction: 60 shares bought at $18.50 plus 40 bought at $22.00 average $19.9000; to lift that to $24.00 by buying at $27.00, 136.666667 shares are needed, and the average becomes $24.0000.

How the average is worked out

Each purchase costs its shares times its price, plus its commission. Add the costs of all the purchases, add the shares, and divide the first total by the second: that quotient is the average cost of one share. It weights every purchase by how many shares it bought, so a large purchase counts for more than a small one, and the order you bought in makes no difference.

The IRS counts a commission this way too. Publication 550 says the basis of shares usually includes commissions paid for the purchase, with an example of 100 shares at $10 and a $50 commission, a basis of $10.50 a share. For its average basis method, the Treasury regulation sets the basis of each identical share at the total basis of all of them in the account, divided by their number.

The average only moves toward the price of each new purchase and never past it. That is why a target outside the span between the current average and the next price cannot be reached, and why a commission counts against a target just above the average: the cost of the purchase has to carry the average there by itself.

Rounding, and which average your tax rules use

Shares go up to 6 decimals, prices up to 4, commissions in whole cents. Every purchase is worked out exactly first; the single rounding step lands on the cent, with exact halves taken upward, and the total adds them up. The average is divided once, at the end, and kept to four decimals, a half going up, because a price has four. The result card shows a dollar amount to the cent, as the IRS prints its own average, and the purchases table adds up to the total. 410 shares that cost $9,100.00, the holding in the IRS's Table 4-2, average $22.1951 here, and the IRS prints $22.20.

Which average, if any, counts for tax is for your own rules to say. In the United States Publication 550 lets you use the average basis only for identical shares left with a custodian or agent that are shares of a mutual fund or are held through a dividend reinvestment plan, and only when you elect it; otherwise, if you cannot identify the shares sold, the first bought are the first sold, and you may identify particular lots. In some countries the rule is a weighted average of everything held, in others a choice of methods. Read your own tax authority’s rule before using this figure in a return.

What the page leaves out

Sales, stock splits, dividends paid in shares and any adjustment to basis are not followed: a holding that changed shape needs its own accounting. Currency conversion, stamp duties, taxes on the purchase, interest on borrowed money and inflation stay outside the figures, unless you put them into a commission field. A figure here describes what you paid for the shares, not what they will be worth.

Sources

  • IRS Publication 550, Investment Income and Expenses. Commissions as part of the cost of shares (the Fund A example), the average basis method (the aggregate basis divided by the aggregate number of shares, with its worksheet, its examples and Table 4-2) and the first-in first-out rule where shares cannot be identified; the 2025 edition, read on 2026-11-26.
  • 26 CFR 1.1012-1, Basis of property. Paragraph (e)(7)(i), the computation of average basis: the basis of each identical share is the aggregate basis of all the shares of that stock in the account divided by the aggregate number of shares; read on 2026-11-26.

Questions

Why does my broker show a different average cost?

A broker’s figure may reflect stock splits, shares bought with dividends, transfers and fees that this page does not follow, and it may round the average to the cent before using it. Enter your purchases the way your statements list them, and expect a gap of a few cents where a broker rounds earlier.

Do commissions count in the average?

Yes. A commission paid on a purchase is added to what the shares cost, which raises the average. In the first example the three commissions of $4.95 add $0.1485 to the average of each share.

What is averaging down, and what does it change?

Buying more at a price below your average pulls the average toward that price, so the shares need a smaller rise to be worth what they cost. The extra shares cost money too, and the position grows: in the first example 79.933334 more shares add $2,642.75. Whether that suits you is for you to judge; the page only does the arithmetic.

Do fractions of a share work?

They do, to 6 decimal places, so 0.5 or 2.125 are valid. Each purchase is computed exactly and only then brought to the cent, which makes 0.5 share at $0.01 cost a cent, not half of one.

Why does the page say my target cannot be reached?

A new purchase moves the average toward its own price and no further. A target above both the average and the next price, or below both, or equal to the next price, is out of reach at any quantity. A commission can also put a target just beside the average out of reach, because the cost of the purchase lifts the average before the shares can lower it.

Is this the figure to report to the tax authority?

Only if your own rules use an average of this kind. Many holdings are reported lot by lot, first in first out or with identified shares, and the average is allowed only for certain holdings. Look up what your own tax authority requires.

Reviewed by the DirectCalculators team. The formula is tested against its source’s worked examples, where the source gives any, and cases worked by hand; see how we calculate.