Buy the same stock at three different prices, and your true entry price gets blurry fast. That’s where average cost basis helps.
It turns a stack of buy prices into one blended number, so you can track your position with less guesswork. Still, that simple number can mean different things for taxes, depending on your country, account type, asset class, and broker’s reporting rules.
Start with the math, then use the right method for your account.
The simple formula behind average cost basis
Average cost basis is a weighted average, not a plain average of the prices you paid. That matters because buying 50 shares at one price counts more than buying 5 shares at another.
The formula is:
Average cost per share = Total amount invested / Total shares owned
Your total amount invested is the sum of every purchase lot. If commissions or transaction fees apply, add them too, because they increase your cost basis.

A quick example shows why weighting matters. If you buy 10 shares at $20 and 30 shares at $30, the simple average of the two prices is $25. But that is not your real cost. You spent $200 on the first lot and $900 on the second, for a total of $1,100 across 40 shares. Your average cost basis is $27.50.
Many investors use this number to track a stock position and estimate break-even levels. However, tax treatment is not always the same as the tracking number on your screen. In the US, IRS Publication 551 on basis of assets explains that basis rules can vary by asset, and average basis is commonly associated with certain mutual fund shares. For background on that distinction, Investopedia’s explanation of the average cost method is a helpful summary.
For tax reporting, don’t assume the average shown in your portfolio is the method your broker will use when you sell.
Worked examples with multiple stock purchases
The process stays the same every time. First, multiply shares by price for each buy. Next, add all lot costs together. Then add all shares together. Finally, divide total cost by total shares.
Example 1: Three buys at falling prices
Say you bought the same stock in three batches:
| Buy | Shares | Price per share | Lot cost | Running average |
|---|---|---|---|---|
| 1 | 10 | $50.00 | $500.00 | $50.00 |
| 2 | 15 | $40.00 | $600.00 | $44.00 |
| 3 | 25 | $30.00 | $750.00 | $37.00 |
| Total / Final Avg | 50 | – | $1,850.00 | $37.00 |
Your average cost basis is $37.00 per share.
That means your blended entry price is $37, even though you never bought at exactly $37. If the stock later trades at $42, you’re up $5 per share before fees and taxes. If it drops to $35, you’re below your average cost.
Example 2: Uneven purchases at mixed prices
Now try a less tidy set of buys:
| Buy | Shares | Price per share | Lot cost | Running average |
|---|---|---|---|---|
| 1 | 8 | $120.00 | $960.00 | $120.00 |
| 2 | 12 | $95.00 | $1,140.00 | $105.00 |
| 3 | 5 | $110.00 | $550.00 | $106.00 |
| Total / Final Avg | 25 | – | $2,650.00 | $106.00 |
Here, the average cost basis is $106.00 per share.
If you later sell 10 shares at $118, your gain using that average would be:
($118.00 – $106.00) x 10 = $120.00
That gives you a quick estimate of profit on the shares sold. For more examples of the math in plain language, LegalClarity’s average cost basis guide and Accounting Insights on calculating average cost basis both walk through the same weighted-average idea.
One more practical point matters here. Average cost basis is often used as a convenience number for portfolio tracking. Yet brokers may still track each purchase lot separately, because tax rules may require another method.
Average cost basis vs. FIFO and specific identification
Average cost basis is only one way to assign cost to shares you sell. The other common methods are FIFO and specific identification.
FIFO means “first in, first out.” Your oldest shares are treated as sold first. If those early shares were cheap, FIFO can create larger taxable gains.
Specific identification lets you choose the exact lot you want to sell. That can give you more control. For example, you might sell your highest-cost shares first to reduce gains in a taxable account.

Average cost basis takes a middle path. It blends all identical shares into one per-share cost, which makes recordkeeping easier. That’s one reason investors talk about it so often. Still, the right tax method can depend on where you live, whether the account is taxable or tax-sheltered, what asset you hold, and how your broker reports lots.
In other words, the math is simple, but the reporting rules may not be. Some brokers default to FIFO. Some allow lot selection before a trade settles. Some asset classes have their own rules. For mutual fund investors, Investopedia’s guide to mutual fund cost basis methods gives a useful overview.
Confirm your broker’s default cost basis method before you place a sell order, and check tax rules with a qualified professional.
Conclusion
Your average cost basis comes from one clean calculation: total dollars invested, divided by total shares owned. Because it’s weighted by share count, it gives a far better picture than averaging the prices alone.
Use that number to track your position, judge your break-even point, and make cleaner decisions after several buys. For taxes, though, always verify which method applies, because cost basis rules can change the result more than most investors expect.

