How the stock average calculator works
A stock average calculator finds your weighted average cost per share by dividing everything you paid by the total shares you hold. Buy the same stock more than once at different prices and you no longer have a single purchase price, you have a blended one, and that blended figure is what tells you whether you are up or down today. Enter each buy as a share count and a price, switch the region to rupees or dollars, and the average drops out instantly.
It also records sales, which none of the other calculators we checked can do. That matters more than it sounds, because once you've sold any shares, "your average" stops being one number, and the one your broker shows is worked out by a rule the law sets. More on that below.
What is the average share price formula?
The average share price is the total amount invested divided by the total number of shares: (shares1 x price1 + shares2 x price2 + and so on) / (shares1 + shares2 + and so on). It is a weighted average, which means each buy counts in proportion to how many shares it covers, so a big lot pulls the average toward its price and a small one barely moves it.
Most people trip on the same shortcut. Buy 100 shares at ₹250 and then 200 shares at ₹275, and it is tempting to average the two prices to ₹262.50. That misreads your position, because you own twice as many shares at the higher price. Weighting by quantity gives ₹80,000 paid across 300 shares, or ₹266.67 a share, ₹4.17 higher than the naive mid-price.
| Method | What it does | Result on the buys above |
|---|---|---|
| Simple average | Mean of the two prices, ignores size | ₹262.50 |
| Weighted average | Total paid over total shares | ₹266.67 |
The gap widens the more lopsided your lots are. Two shares at ₹100 and 998 at ₹500 sit almost entirely at ₹500, yet the simple average would tell you ₹300, a number you never paid and never will.
Sold some already? Then there are three averages
After a sale, your remaining shares are the ones bought most recently, because the law matches every sale to your oldest shares first. That rule is called FIFO, first in, first out, and it's why the average on your broker's app can differ from the one you'd work out by hand.
Zerodha publishes a case that shows it cleanly. Buy 50 shares of ITC at ₹260, then 30 at ₹256, sell 20 at ₹275, then buy 20 more at ₹270. Zerodha's holdings screen shows an average of ₹261. There are three ways to arrive at "an average" for that holding, and they don't agree:
| Method | Average | What it assumes |
|---|---|---|
| FIFO | ₹261.00 | The sale took 20 of the ₹260 shares, leaving 30 @ ₹260, 30 @ ₹256 and 20 @ ₹270 |
| Average cost | ₹261.38 | The sale left the average at ₹258.50, then the last buy lifted it |
| Every buy, ignoring the sale | ₹260.80 | The sale never happened |
Only the first matches the broker, and only the first matches your tax return. The gap here is small. It isn't always: the realised gain on that sale is ₹300 under FIFO and ₹330 under the average-cost method, and on a large holding with old, cheap lots the difference in taxable gain can be substantial.
None of the other calculators we checked lets you record a sale; one takes a sell price, but only to value the holding. So anyone who has sold and enters their purchases gets the third figure, the one that matches nothing. Add your sale as a row in this tool, in the order it happened, and it matches the shares out FIFO and shows the average and the cost of the shares you still hold, the realised gain on what you sold, and the other two averages for comparison.
What does averaging down mean?
Averaging down means buying more shares after the price drops, which lowers your average cost per share. It is the move behind a lot of "should I add more?" questions, and the maths is the same weighted average run forward with one extra lot. Say you hold 300 shares at an average of 266.67 and the price has fallen to 200. Buy 100 more at 200 and your average slides to 250, because you have now paid 100,000 across 400 shares.
The average-down planner in this tool runs that logic in reverse, which none of the ten calculators we checked does. Instead of guessing a share count and checking the result, you set the average you want to reach and it returns the exact number of shares to buy at a given price. To reach an average, the price you buy at has to sit below that target, and the further below it sits, the fewer shares you need.
| Target average | Shares to buy at 200 | New total shares |
|---|---|---|
| 260 | 34 | 334 |
| 250 | 100 | 400 |
| 240 | 200 | 500 |
Those rows start from the same 300 shares at 266.67. Reaching for a lower average costs disproportionately more shares, because each new share moves a bigger pile by less. If you've sold some shares, the planner works from what you still hold, at its FIFO cost, which is the average your broker is showing you.
Should you include brokerage and charges?
Your true cost per share includes what you paid to acquire the shares, not just the quoted price: brokerage, and in India the securities transaction tax and stamp duty on each buy. None of the ten calculators we checked folds these in. A few say so in their small print, and the rest simply report the bare average, which quietly understates what you actually need the price to recover to.
Enter the total buy charges and the tool shows both figures. On that ₹80,000 position, ₹300 of charges lifts the average from ₹266.67 to ₹267.67 across 300 shares, and that second number is your real break-even before you sell. It is small on a large trade and meaningful on a small one, which is exactly why a fixed 20 rupee brokerage hurts a ₹2,000 buy far more than a ₹2,00,000 one. If you've sold part of the holding, the charges are spread evenly across every share you bought and travel with the shares you still hold. To break the charges down line by line for an Indian trade, the brokerage calculator does the STT, stamp duty and exchange fees in full.
Is my average price the cost used for tax?
Only while you haven't sold anything. Once you sell, both India and the US work out the cost of the shares sold from your oldest purchases, not from the average.
In India, section 45(2A) of the Income-tax Act, 1961 says that for securities held through a depository, "the cost of acquisition and the period of holding of any securities shall be determined on the basis of the first-in-first-out method". The Income-tax Act, 2025 keeps the rule in section 67(7)(c) in almost the same words. The CBDT's Circular 768 of 24 June 1998 adds two practical points: FIFO runs separately for each demat account, so shares in a second account aren't treated as sold, and it doesn't reach shares held as physical certificates. Zerodha states the consequence plainly: the Income Tax Department "mandates using FIFO to report profit and loss (P&L) when filing income tax returns", which is why its holdings average is FIFO too.
In the US, IRS Publication 550 is just as direct: if you can't 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 is allowed only for identical shares held with a custodian that are mutual fund shares or are held in a dividend reinvestment plan. For ordinary stock you can choose a specific lot instead, but only by telling your broker which shares to sell at the time and getting written confirmation; otherwise it's FIFO.
The previous version of this page said the opposite, that the weighted average was the cost basis the IRS uses and India's cost of acquisition, and it cited Publication 550 for a rule Publication 550 rules out. We've corrected it. Two calculators ranking for this term make a version of the same mistake today: one says its weighted average "ensures accurate capital gains/loss reporting for simplified tax filing", and another lists finding an average "for tax" among its uses.
This tool gives you the cost of the shares you sold, matched FIFO, and the realised gain on that basis, but it doesn't apply a tax rate, a holding period or an exemption. The capital gains calculator does that for India, from the real buy and sell dates. Treat the figures here as inputs to that step, and check your contract notes and a qualified professional before you file.
What this calculator leaves out
It doesn't pull a live market price, so the current price is a value you type in, which keeps the result stable and private. It matches sales FIFO, the default in both countries, and shows the average-cost figure alongside, but it can't do US specific-lot identification, so if you told your broker to sell particular shares, the cost of those is yours to enter. It works on one demat or brokerage account at a time, which is how Indian FIFO runs anyway.
Corporate actions are still a manual step. A bonus issue adds shares at zero cost, which is why Zerodha's own help pages show an average falling sharply after one, and selling afterwards can leave an average of ₹0 once the bought shares have gone first. Splits change the share count without changing what you paid. Add bonus shares as a buy at a price of 0, and adjust share counts yourself after a split.
Frequently asked questions
What is a stock average calculator? A stock average calculator works out your weighted average cost per share when you have bought the same stock at more than one price. It divides the total amount you paid by the total shares you hold, so buying 100 shares at 250 and 200 shares at 275 gives an average of 266.67, not the plain mid-price of 262.50.
How is the average share price calculated? The average share price is the total amount invested divided by the total number of shares: (shares1 times price1 + shares2 times price2 and so on) divided by (shares1 + shares2 and so on). It is a weighted average, so a buy counts in proportion to how many shares it covers, which is why a larger lot pulls the average toward its price.
What is the difference between a weighted average and a simple average? A simple average adds the buy prices and divides by how many buys there were, ignoring size. A weighted average multiplies each price by its share count first. Buy 100 shares at 250 and 200 at 275 and the weighted average is 266.67, while the simple average of the two prices is 262.50, so the simple version understates your real cost here by 4.17 a share.
What happens to my average after I sell some shares? Your remaining shares are treated as the most recently bought ones, because sales are matched to your oldest shares first under FIFO. In Zerodha's published example, buying 50 at 260 and 30 at 256, selling 20, then buying 20 at 270 leaves an average of 261, while leaving the average unchanged through the sale gives 261.38 and averaging every buy gives 260.80. Only the FIFO figure matches the broker and the tax return.
What does averaging down mean? Averaging down means buying more shares after the price falls, which lowers your average cost per share. If you hold 300 shares at an average of 266.67 and buy 100 more at 200, your average drops to 250. The average-down planner in this tool reverses that: you set a target average and it returns the exact number of shares to buy at a given price.
Should I include brokerage and charges in my average? Your true cost per share includes what you paid to buy: brokerage, and in India the securities transaction tax and stamp duty. Enter the total buy charges and the tool shows both the bare average and the average with charges. On an 80,000 rupee position, 300 rupees of charges lifts the average from 266.67 to 267.67 across 300 shares.
Is my average price used for capital gains tax? Only until you sell. In India, section 45(2A) of the Income-tax Act, 1961, now section 67(7)(c) of the 2025 Act, requires the cost of demat shares sold to be worked out first-in-first-out, account by account. In the US, IRS Publication 550 says you cannot use the average price per share for a sale of stock, except for certain mutual fund shares, so the default is FIFO unless you identify the specific lot with your broker. This tool shows the FIFO cost of the shares you sold and the realised gain, but does not calculate the tax.
Does the average change when the market price moves? No. Your average cost is fixed by what you actually paid, so it only changes when you buy or sell shares. The current market price you enter drives the unrealised profit or loss and the return percentage, but it never alters the average cost per share.
Can I use this for mutual fund units or crypto? Yes. The weighted average works for any asset bought in parts at different prices, so units of a mutual fund or a quantity of a coin follow the same total-paid divided by total-quantity rule. US mutual fund shares are also the one case where the IRS lets you use the average-cost figure for tax, which the tool shows beside the FIFO one once you add a sale.
Sources
- IRS Publication 550, Investment Income and Expenses: identification of shares sold and the average basis method
- CBDT Circular No. 768 of 24 June 1998, FIFO for securities held in demat form
- Income-tax Act, 2025, section 67, including sub-section (7)(c)
- Zerodha, how the buy average of holdings is calculated
- Zerodha, why the average falls after bonus shares