Stock average calculator: average cost per share and shares needed to average down
The average cost per share is the total you paid divided by the total shares you bought, so 10 shares at $50 and 20 shares at $35 average $40.00 a share. This calculator also works out how many more shares you would need to buy at a price you enter to bring your average down to a target (“average down”). It does not say whether buying is a good idea, and the weighted average is not necessarily the basis used when you sell: see the stock profit calculator for a sale.
Stock average calculator
Average cost of several purchases
Average cost per share:
$40.00
30 shares, total cost $1,200.00, from 2 purchases.
Average down: shares needed to reach a target average
Shares to buy (rounded up to whole shares):
100
- Exact solution: 100 shares
- Cost of that purchase, including the fee: $3,000.00
- Average cost per share afterwards: $40.00
- Average cost = total cost ÷ total shares, with commissions added only when the box is ticked. Blank rows are ignored.
- Average down: shares = (shares held × current average + fee − target × shares held) ÷ (target − buy price). The buy price must be below the target, and the target below the current average.
- The average is a weighted average of what you entered. It is not necessarily the basis your broker reports or the IRS requires for a sale; see the IRS rules quoted on this page.
Worked examples
These results come from the same code as the calculator. They are FedRateCalc arithmetic, not examples printed by the IRS.
| Case | Result |
|---|---|
| 10 shares at $50 ($5 fee) and 20 shares at $35 ($7 fee) | $40.00 a share without fees; $40.40 with fees |
| Hold 100 shares at an average of $50; target $40; buy at $30 | 100 shares for $3,000.00, new average $40.00 |
| The same position with a target of $45 | 33.333333 exactly, so 34 whole shares, new average $44.93 |
What the IRS says about basis, identifying shares and averages
IRS Publication 550 (2025) describes the basis of stock you bought:
“The basis of stocks or bonds you own is generally the purchase price plus the costs of purchase, such as commissions and recording or transfer fees. If you acquired stock or bonds other than by purchase, your basis is usually determined by fair market value or the previous owner's adjusted basis as discussed earlier under Basis Other Than Cost.”
IRS Topic No. 703 says the same about stocks and bonds you buy:
“If you buy stocks or bonds, your basis is the purchase price plus any additional costs such as commissions and recording or transfer fees.”
When you sell part of a position, it says:
“If you can adequately identify the shares of stock or the bonds you sold, their basis is the cost or other basis of the particular shares of stock or bonds.”
“If you buy and sell securities at various times in varying quantities and you cannot adequately identify the shares you sell, the basis of the securities you sell is the basis of the securities you acquired first. Except for certain mutual fund shares, discussed later, you cannot use the average price per share to figure gain or loss on the sale of the shares.”
The average basis method it describes applies in these cases:
“You can use the average basis method to determine the basis of shares of stock if the shares are identical to each other, you acquired them at different times and different prices and left them in an account with a custodian or agent, and either:
- They are shares in a mutual fund (or other regulated investment company);
- They are shares you hold in connection with a DRIP, and all the shares you hold in connection with the DRIP are treated as covered securities (defined later); or
- You acquired them after 2011 in connection with a DRIP.
”
So the weighted average this calculator shows is a way to see your cost per share; for most stock sales the basis follows the shares sold, not the average. Brokers report basis on Form 1099-B, and Publication 550 says:
“If you sold a covered security in 2025, your broker should send you a Form 1099-B that shows your basis.”
“Generally, a covered security is a security you acquired after 2010, with certain exceptions.”
The Form 1099-B and Form 8949 pages explain the forms, and the capital gains tax calculator estimates tax on a sale. If a company splits its shares, the stock split calculator adjusts the cost per share.
What the calculator assumes
- Average cost is a weighted average: total cost ÷ total shares. Commissions are added only when the option is ticked. A row left blank is ignored; a row with shares but no price, or a negative number, is an error.
- Average down solves (shares held × current average + fee − target × shares held) ÷ (target − buy price) and rounds up to whole shares, so the new average is at or below the target.
- The target must be below your current average, and the price you buy at must be below the target. Otherwise no number of shares reaches it, and the calculator says so.
- The fee in average-down mode is one flat amount for the purchase. Taxes and price changes are not modeled.
Frequently asked questions
How do I calculate the average cost per share?
Add up the cost of every purchase and divide by the total number of shares: for 10 shares at $50 and 20 shares at $35, ($500 + $700) ÷ 30 = $40.00 a share. This is FedRateCalc arithmetic. IRS Publication 550 describes basis as the purchase price plus the costs of purchase, such as commissions.
Are commissions included in the average?
They are included when the fees option is on. IRS Publication 550 says the basis of stock is generally the purchase price plus the costs of purchase, such as commissions and recording or transfer fees, so the option shows a cost per share that includes them; turning it off shows the plain price average.
Is the average cost the basis the IRS uses to figure my gain?
Not generally for stock. IRS Publication 550 says that if you can adequately identify the shares you sold, their basis is the cost of those shares, and if you cannot, the basis is that of the securities you acquired first; except for certain mutual fund shares, you cannot use the average price per share. The average basis method applies to identical shares acquired at different times and prices and left in an account with a custodian or agent, and only if they are mutual fund shares or DRIP shares: shares held in connection with a DRIP when all of those DRIP shares are treated as covered securities, or shares acquired after 2011 in connection with a DRIP.
What does averaging down mean, and how many shares does the calculator solve for?
FedRateCalc uses "average down" to mean buying more shares at a lower price so that the average cost per share falls to a target. Shares needed = (current shares × current average + fee − target × current shares) ÷ (target − buy price), rounded up to whole shares. The calculation is arithmetic; it does not say whether buying more shares is advisable.
Why does the calculator say a target cannot be reached?
The purchase has to be at a price lower than the target average, and the target has to be lower than the current average; otherwise no number of shares moves the average to the target. These are limits of the FedRateCalc formula, which treats the fee as one flat amount for the purchase.
Will my broker report the same basis?
IRS Publication 550 says that if you sold a covered security in 2025, your broker should send a Form 1099-B that shows your basis, and that a covered security is generally one acquired after 2010, with certain exceptions. The broker's method, such as specific lots or average basis for eligible shares, decides what appears on the form; this calculator does not read your account.
Related calculators and guides
Sources
Pages were read on November 6, 2026. IRS Publication 550 is the 2025 edition as published on irs.gov; IRS Topic No. 703 was read directly.
Reviewed November 6, 2026. FedRateCalc is not affiliated with the IRS, the SEC or FINRA; their sites are the official sources, and any later change they publish overrides this site. Results are estimates from the numbers you enter, not financial or tax advice.