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.
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.
Breakdown
| Purchase | Shares | Cost with commission |
|---|---|---|
| Purchase 1 | 50 | $2,104.95 |
| Purchase 2 | 30 | $1,099.95 |
| Purchase 3 | 20 | $629.95 |
| All purchases | 100 | $3,834.85 |
How this was calculated
Step by step, with the figures above.
- Total costthe sum of shares × price + commission of each purchase, each to the cent. purchases: 3. Rounded to 2 decimal places, halves away from zero.
- Total sharesthe sum of the shares of each purchase. purchases: 3
- Average cost per sharetotal cost ÷ total shares. total cost: $3,834.85 · total shares: 100. Rounded to 4 decimal places, halves away from zero.
- Market valuetotal shares × current price. total shares: 100 · current price: $38.40. Rounded to 2 decimal places, halves away from zero.
- Unrealized gain or lossmarket value − total cost. market value: $3,840.00 · total cost: $3,834.85
- Unrealized returngain or loss × 100 ÷ total cost. gain or loss: $5.15 · total cost: $3,834.85. Rounded to 2 decimal places, halves away from zero.
- Shares to buy(target × total shares − total cost − next commission) ÷ (next price − target). target: $36.00 · next price: $33.00 · next commission: $4.95. Rounded up to 6 decimal places, away from zero.
- Cost of the next purchaseshares to buy × next price + next commission. shares to buy: 79.93 · next price: $33.00. Rounded to 2 decimal places, halves away from zero.
- Average after the next purchase(total cost + cost of the next purchase) ÷ (total shares + shares to buy). total cost: $3,834.85 · next purchase: $2,642.75. Rounded to 4 decimal places, halves away from zero.
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.
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.
Related calculators
- Discount calculator: stacked percent off and price before
- Tip and bill split calculator with round-up shares
- Unit price comparison: cost per kilo, litre, pound or piece
- Net worth calculator: assets, debts and home equity
- Price per square foot and square meter: compare two homes
- Basis points to percent: new rate and yearly interest
- Return on investment calculator: ROI and annualized return
- CAGR calculator: compound annual growth rate
- Stock profit calculator with fees and dividends
- Return on equity calculator with DuPont breakdown
- Loan to value calculator: LTV, CLTV and HCLTV
- Net effective rent calculator with free months and credits
- Prorated rent calculator by day for a partial month
- Loan payment calculator with amortization schedule
- Loan payoff calculator: extra payments and interest saved
- Credit card payoff calculator: minimum or fixed payment
- Time value of money calculator: PV, FV, payment and rate
- Annuity payout calculator: income from savings
- Compound interest calculator with monthly deposits
- Effective annual rate calculator (APR to APY)
- CD calculator: interest, APY and a ladder for term deposits
- Simple interest calculator by days, months or years
- Rule of 72 calculator: years to double or the rate needed
- Net present value calculator: NPV and discounted cash flow
- IRR calculator: internal rate of return on yearly flows
- Payback period calculator: simple and discounted
- WACC calculator: weighted average cost of capital
- Price elasticity calculator: demand, supply, cross-price
- Rent affordability calculator: what rent a standard allows
- Debt to income ratio calculator: your DTI against a limit
- Real estate commission calculator: fee, VAT and split
- Sales tax calculator: add tax or find the price before it
- Loan APR calculator: the true yearly cost with fees
- Bond price and yield to maturity calculator
- Student loan repayment calculator for US federal loans
- Depreciation calculator: MACRS, straight line, declining
- Rental property depreciation calculator by country
- Adjusted gross income (AGI) and MAGI calculator
- Cash rounding calculator: the cash total by country
- Coin counter: the value and weight of your coins
- PTO accrual calculator: leave earned per pay period
- PayPal fee calculator: what you keep from a payment
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.