How do you calculate the average price of a stock?
Add up what every purchase cost, then divide by the number of shares you own: average cost per share = (shares x price for each buy, added together, + fees) / total shares. It is a weighted average, so a large buy pulls the figure toward its price far more than a small one.
Take the default buys above: 100 shares at $50, 100 at $40 and 50 at $35. They cost $5,000, $4,000 and $1,750, a total of $10,750 for 250 shares, so the average is 10,750 / 250 = $43.00. The plain mean of the three prices is $41.67, which is wrong here because only half as many shares were bought at $35.
Enter a current price and the page values the holding and shows the gain or loss. At $46 the 250 shares are worth $11,500, a gain of $750 or 6.98% on the cost. At $40 the same holding is down $750. The calculator holds no market data, so the price is always one you type in.
Stock average calculator with fees
Commission and purchase duty are part of what a share cost you, so the calculator adds the fee column to the total before dividing. Put a $5 fee on each of the three default buys and the total becomes $10,765, which lifts the average from $43.00 to $43.06. The average before fees is still shown alongside, so you can see what the charges did.
A fee to sell, entered under Fees, does not change what you paid. It changes the price you need to get out level: the breakeven price = (total cost + fee to sell) / shares. With a $5 fee to sell, breakeven on the example is $10,770 / 250 = $43.08. At a current price of $46, the gain after both sets of fees is $730, or 6.78% of the $10,765 cost, against $750 with no fees at all.
On small positions the effect is larger than people expect. A flat fee on a buy of 10 shares moves the average ten times as much as the same fee on 100 shares.
How does averaging down work?
Averaging down means buying more of a stock you already hold, at a price below your average, so the average falls. The Average down tab turns it around: you give a target average and it works out the shares needed.
The formula comes from setting the new average equal to the target and solving for the extra shares: shares to buy = (shares held x (average - target) + fee) / (target - new price). With 200 shares at an average of $50, a new price of $30 and a target of $40, that is 200 x 10 / 10 = 200 shares, costing $6,000. The holding becomes 400 shares at exactly $40.
Notice the denominator. As the target gets close to the new price, it shrinks toward zero and the share count explodes. Every share added at $30 pulls the average toward $30, but the average can never reach it, because the old shares at $50 are still in the pool. That is why a target at or below the new price is impossible, and the calculator says so instead of printing a number. Buying at or above your current average cannot lower it either.
What averaging down does not change is the loss at today's price. Before the buy, 200 shares bought at $50 and now at $30 are $4,000 down. After it, 400 shares averaging $40 at a price of $30 are still $4,000 down. The difference is that breakeven is now a 33.33% rise away instead of 66.67%, and $6,000 more of your money now depends on the same stock.
How many shares does it take to average down?
The answer grows faster than most traders expect. Here is the same holding of 200 shares at $50, buying more at $30, for a range of target averages. Shares are rounded up to whole shares, so the new average lands at or just under the target:
| Target average | Shares to buy at $30 | Cost of the buy | Rise from $30 to break even |
|---|---|---|---|
| $48 | 23 | $690 | 59.79% |
| $45 | 67 | $2,010 | 49.94% |
| $42 | 134 | $4,020 | 39.92% |
| $40 | 200 | $6,000 | 33.33% |
| $35 | 600 | $18,000 | 16.67% |
| $32 | 1,800 | $54,000 | 6.67% |
Each input moves the answer in its own direction. More shares already held means more new shares for the same target. A lower new price means fewer shares, because each one pulls harder. A target closer to the current average needs only a handful; a target close to the new price needs a holding many times the original. A fee adds a little: with a $10 fee on the buy, the default case needs 201 shares instead of 200.
The chart under the calculator draws the whole curve: the average falling steeply at first, then flattening as it approaches the new price.
Worked examples in pounds and euros
The arithmetic is the same in every currency; only the symbol and decimals change. Nothing is converted.
Pounds, with purchase duty. GOV.UK's page on tax when you buy shares says you usually pay 0.5% on the transaction, based on the price you pay. Buy 200 shares at £3.20 and 300 at £2.60. The shares cost £640 and £780, and 0.5% of each is £3.20 and £3.90, entered in the fee column. The total is £1,427.10 for 500 shares, an average of £2.8542, shown as £2.85, against £2.84 without the duty. At £3.00 the holding is worth £1,500, a gain of £72.90 or 5.11%.
Euros, averaging down. You hold 80 shares at an average of €120 and the price is now €90. To reach an average of €105 you need 80 x 15 / 15 = 80 more shares, costing €7,200. Breakeven drops from a 33.33% rise to a 16.67% rise, while the money in the stock goes from €9,600 to €16,800.
Average cost for tax: UK, US and Canada
Tax offices do not all use the average a trading screen shows, so check which method applies to you before treating this figure as a tax number.
- UK. HMRC's helpsheet HS284 Shares and Capital Gains Tax (2025), updated 6 April 2026, pools all shares of the same class in the same company into a Section 104 holding, in which each share carries the same average cost. A sale is matched first with shares bought the same day, then with shares bought in the following 30 days, and only then with the pool.
- US. IRS Publication 550 (2025) says that when you cannot identify which shares you sold, the ones bought first are treated as sold first. Average basis is allowed only for certain shares left with a custodian or agent: mutual fund shares, and dividend reinvestment plan shares such as those acquired after 2011. For other shares, the average price per share cannot be used to work out a gain or loss.
- Canada. The Canada Revenue Agency's guide T4037, Capital Gains 2025, recalculates the adjusted cost base of identical shares at each purchase. Its example ends with 50 shares at $18 joined by 350 at $21: 400 shares costing $8,250, or $20.63 each. Enter those two buys here and you get the same $20.63.
The calculator applies none of these matching rules. It averages the buys you enter, which is the figure most platforms show and the one that sets your breakeven.
How to calculate average share price in Excel or Google Sheets
Put shares in column B, prices in column C and fees in column D, one row per buy. Then the average cost is =(SUMPRODUCT(B2:B4,C2:C4)+SUM(D2:D4))/SUM(B2:B4). For the three default buys with no fees this returns 43, the same as the calculator. SUMPRODUCT multiplies each row's shares by its price and adds the results, which is the weighted part a plain AVERAGE of column C misses.
For averaging down, the shares needed are =ROUNDUP((held*(avg-target)+fee)/(target-price),0), with each name replaced by its cell. Wrap it in IF(AND(price<target,target<avg), ..., "not reachable") so the sheet does not return a negative or impossible count.
Common mistakes when averaging a stock
- Taking the mean of the prices. Three buys at $50, $40 and $35 do not average $41.67 unless each was the same number of shares.
- Leaving out fees and duty. They are part of the cost, and on small buys they move the average noticeably.
- Counting a sale as a price change. Selling part of a holding at the average cost leaves the average of the remaining shares where it was; only new buys move it.
- Mixing currencies. If you bought a foreign stock in two currencies, convert every buy into one currency first.
- Reading a lower average as a smaller loss. At today's price the loss in money is unchanged by averaging down; only the distance to breakeven and the amount at stake move.
- Picking a target at or below the new price. No number of shares reaches it.
What this calculator leaves out
It works on the buys and prices you type, and nothing else. It does not hold live prices, so the gain or loss is only as current as the price you enter. It does not adjust for stock splits, so a holding bought before a split needs its share counts and prices restated first. Dividends, currency conversion costs, borrowing costs on margin and tax are all outside the figure. It also says nothing about whether adding to a position is wise: it shows the cost of reaching a target, and the money that ends up depending on one stock.
Glossary
Average cost per share: total money paid for a holding, fees included, divided by the shares in it. Weighted average: an average in which each price counts in proportion to the shares bought at it. Breakeven price: the share price at which selling returns exactly what you paid, after any fee to sell. Averaging down: buying more of a stock below your average to lower it. Averaging up: buying more above your average, which raises it. Cost basis: the cost used to work out a taxable gain, which may follow different matching rules from the average.
Frequently asked questions
How do I calculate my average cost per share?
Multiply the shares in each buy by its price, add those amounts and any fees, and divide by the total shares. For 100 shares at $50, 100 at $40 and 50 at $35, that is $10,750 / 250 = $43.00 a share.
How do I calculate how many shares to buy to average down?
Use shares to buy = (shares held x (current average - target)) / (target - new price), then round up. Holding 200 shares at $50 and buying at $30, a $40 target needs 200 x 10 / 10 = 200 shares, which cost $6,000.
Should fees be included in the average share price?
For your true cost, yes: commission and purchase duty are part of what you paid. The calculator adds them before dividing and shows the average before fees separately. A $5 fee on each of three buys lifts a $43.00 average to $43.06.
Why can't I average down below the price I am buying at?
Each new share bought at that price pulls the average toward it, but the shares you already own at a higher cost keep the average above it. The gap shrinks with every share and never closes, so no finite number of shares reaches a target at or below the new price.
What is the breakeven price for shares bought at different prices?
It is the total cost of all the buys, plus any fee to sell, divided by the number of shares. With $10,765 of cost and a $5 fee to sell on 250 shares, breakeven is $43.08.
Is my stock average the same as my cost basis for tax?
Not always. The UK pools shares at an average cost under HMRC's Section 104 rules, Canada averages identical shares into an adjusted cost base, and the US normally treats the first shares bought as the first sold unless you identify the shares. The calculator shows the plain average and applies none of these rules.
Does selling some shares change my average cost?
Under the average cost method it does not. The shares sold carry the average cost out with them and the rest keep it. The Canada Revenue Agency's own example sells 200 of 250 shares averaging $18, and the 50 left still average $18.
How do I calculate stock average in Excel?
With shares in column B, prices in column C and fees in column D, use =(SUMPRODUCT(B2:B4,C2:C4)+SUM(D2:D4))/SUM(B2:B4). A plain AVERAGE of the prices gives the wrong figure unless every buy was the same size.
What happens to my risk when I average down?
The loss at today's price stays the same, but more money now depends on the stock. After buying 200 more shares at $30 to reach a $40 average, each further $1 fall costs $400 instead of $200, while breakeven moves from a 66.67% rise to a 33.33% rise.
Can I use this stock average calculator in pounds, euros or dirhams?
Yes. Pick any of 24 currencies and amounts are shown in that currency. Enter every price in the same currency; nothing is converted, so a stock bought partly in another currency needs converting before you enter it.
Courses for managing a stock position
Stock Market Trading Beginners Course
Structured online beginner program covering UK, USA, and European stock markets, technical analysis, fundamental analysis, risk management, and trading psychology.
See what the course coversHow to Control Emotions in Stock Trading
Course on trading psychology and emotional control, covering methods to reduce impulsive trades and build a calm, disciplined trading mindset.
See what the course coversStock Trading Rules and Strategies
Practical program explaining why trading rules matter and how traders apply predefined strategies for day trading and short-term market analysis.
See what the course coversSources and review
Last reviewed 13 November 2026 by the NIFM Academy editorial team. Next review by 13 May 2027.
- HMRC, HS284 Shares and Capital Gains Tax (2025), Section 104 holding at average cost; same-day and 30-day matching rules. Helpsheet updated 6 April 2026. Checked 13 November 2026.
- IRS, Publication 550 (2025), Investment Income and Expenses, first-in first-out when shares cannot be identified; average basis only for certain mutual fund and dividend reinvestment plan shares. Checked 13 November 2026.
- Canada Revenue Agency, T4037 Capital Gains 2025 (Rev. 25), adjusted cost base of identical properties recalculated at each purchase, with the 400 shares for $8,250 example. Checked 13 November 2026.
- GOV.UK, Tax when you buy shares, usually 0.5% on the transaction, based on the price you pay. Checked 13 November 2026.
- Weighted average cost arithmetic, average = (sum of shares x price + fees) / shares; averaging down solved for the shares that reach a target, shown in the working under every result. Checked 13 November 2026.