Stock Cost Basis Calculator.
Know Your Break-Even Before Selling.
Calculate your exact average cost basis after multiple stock purchases. See how many more shares you need to reach any target price — and understand your tax position before you sell.
Average Down Calculator
Find the exact shares needed to hit your target average
Your Position
A flat fee per order. It gets absorbed into your average, so you need slightly more shares to hit the same target.
Ready to calculate
Fill in your position details and hit Calculate
What Is Stock Cost Basis?
Your cost basis (also called adjusted cost base or average cost) is the average price per share you paid across all purchases of a stock, including commissions and fees. It is the number that determines your taxable gain or loss when you sell.
Average Cost Method Formula
Cost Basis = Total Amount Invested ÷ Total Shares OwnedTaxable Gain Formula
Gain/Loss = (Sale Price − Cost Basis) × Shares SoldExample: You buy 100 shares at $80 and 100 shares at $60. Total invested = $14,000, total shares = 200. Cost basis = $70/share. If you sell at $90, your taxable gain = ($90 − $70) × 200 = $4,000.
Cost Basis Methods: FIFO vs Average Cost
Average Cost Method
- Blends all purchases into one cost
- Simplest to track, and the right lens for judging a position
- In the US: mutual funds and certain DRIPs only
- Not permitted for ordinary individual stocks
- This calculator uses this method
FIFO (First In, First Out)
- Sells earliest-purchased shares first
- The US default for individual stocks
- Larger loss when your first buys were the expensive ones
- Requires lot-level tracking
- Overridden only by identifying lots at the time of sale
Which method actually applies to you
The distinction that catches people out at tax time
There are two different questions hiding behind “what is my cost basis”, and mixing them up produces a nasty surprise on a partial sale. The first is what is this position costing me — the blended average this calculator returns, and the right number for deciding whether you are up or down. The second is what basis will my tax authority use when I sell, and in the US that is frequently a different number entirely.
For individual stocks, the US default is FIFO: sell part of your holding and the oldest shares are treated as sold first. You can override this by identifying specific lots at the time of sale, if your broker supports it. What you generally cannot do for ordinary stock is use the average cost method — that is reserved for mutual fund shares and certain dividend reinvestment plans.
Worked example. You hold 200 shares: 100 bought at $80 and 100 at $60, a $70 blended average. You sell 100 shares at $75. Under the blended average you would book a $500 gain. Under FIFO you sold the $80 lot, which is a $500 loss. If you identify the $60 lot instead, it is a $1,500 gain. Same sale, same proceeds, three different tax outcomes — which is exactly why the choice is worth making deliberately rather than by default.
What belongs in your cost basis
More than the price you paid
Basis is not just price times quantity. Several things adjust it, and most of them adjust it upward — which means an unadjusted basis overstates your gain and has you paying tax you do not owe.
Commissions and transaction taxes
Fees paid to acquire the shares are added to basis; fees paid to sell reduce your proceeds. Both reduce the taxable gain, and both are routinely left out of a mental calculation.
Reinvested dividends
Every DRIP purchase is a new lot at a new price, bought with money you already paid tax on. Forgetting them is one of the most common ways long-term holders overpay, because each reinvestment genuinely raises your total basis.
Stock splits
A split does not change your total basis, only how it is spread. 100 shares at $80 becomes 200 at $40 in a 2-for-1. Your money did not move; the per-share figure did.
Return of capital distributions
Some distributions are not income but a partial return of what you invested. These reduce your basis rather than being taxed on receipt, which raises the gain when you eventually sell.
US brokers have been required to report basis for covered securities to the IRS for over a decade, so for recent purchases the figure on your 1099-B is usually right. Shares acquired before those rules took effect, transferred in from another broker, or received as a gift or inheritance are where the gaps appear — and those are the ones worth reconstructing before you sell. The definitions are in IRS Publication 550. Rules differ substantially outside the US.
Shares you did not buy
Gifts and inheritances use different basis rules entirely
Everything above assumes you bought the shares. When they arrived some other way, the basis is not what you paid — because you paid nothing — and the two common cases work in opposite directions.
Inherited shares in the US generally receive a stepped-up basis: the value at the date of the previous owner's death, not what they originally paid. Someone who bought at $10 and died holding shares worth $90 passes them on with a $90 basis, and the entire $80 of gain that accrued during their lifetime is never taxed as capital gains. Inherited holdings are also treated as long-term regardless of how briefly you have held them.
Gifted shares are the opposite: the basis usually carries over from the giver, so you inherit their gain along with the stock. Receiving shares bought at $10 and now worth $90 means taking on a $10 basis and the $80 of unrealised gain that comes with it. A special rule applies when the shares are worth less than the giver's basis at the time of the gift, which limits the loss you can claim.
Both cases are worth confirming with a tax professional rather than reconstructing from memory, and both differ substantially outside the US — several countries treat death or gifting as a disposal that triggers tax immediately. See IRS Publication 550 for the US definitions.
Watch Out: The Wash Sale Rule
If you sell shares at a loss and buy the same or substantially identical stock within 30 days before or after the sale, the IRS disallows the tax loss (wash sale rule). The disallowed loss is added to the cost basis of your new shares. Investors who average down into a falling stock should be aware that averaging down within 30 days of a loss-sale can trigger this rule.
Frequently Asked Questions
Can I use the average cost method for individual stocks?▾
In the US, generally no. The average cost method is available for mutual fund shares and certain dividend reinvestment plans, but individual stocks default to FIFO unless you identify specific lots at the time of sale. The blended average is still the right number for judging whether your position is up or down - it is just not necessarily the basis reported when you sell part of it.
Do stock splits change my cost basis?▾
Not your total basis, only the per-share figure. In a 2-for-1 split, 100 shares with an $80 basis become 200 shares with a $40 basis - $8,000 either way. Nothing is taxable and nothing is gained; the same money is simply divided across more shares.
Do reinvested dividends count toward cost basis?▾
Yes, and forgetting them is one of the most expensive record-keeping mistakes long-term holders make. Each reinvestment buys shares with money you have already paid tax on, so it genuinely increases your total basis. Leaving them out overstates your gain and means paying tax twice on the same money.
What if I do not know the cost basis of old shares?▾
Start with your broker: US firms have been required to report basis for covered securities for over a decade, so recent purchases are usually on the 1099-B. For older holdings, transfers from another broker, or gifted and inherited shares, you may need historical statements or price records - inherited shares in particular are typically stepped up to the value at the date of death rather than what the original owner paid. Speak to a tax professional rather than guessing.
What is cost basis and why does it matter?▾
Cost basis is the original value of your investment — typically the total amount paid including commissions. It matters because when you sell, your taxable gain or loss = sale price − cost basis. A lower cost basis means higher taxable gains. Accurate cost basis tracking ensures you don't overpay taxes or miscalculate your actual profit.
How do I calculate cost basis for multiple stock purchases?▾
Using the average cost method: Cost Basis = Total Dollars Invested ÷ Total Shares Owned. Example: Buy 100 shares at $50 ($5,000) and then 50 shares at $40 ($2,000). Total invested = $7,000, total shares = 150. Cost basis = $7,000 ÷ 150 = $46.67 per share. Our calculator handles this automatically for any number of purchases.
What is the difference between FIFO and average cost method?▾
FIFO (First In, First Out): assumes you sell your earliest-purchased shares first. This can result in higher taxes if your first purchases were at low prices. Average Cost Method: calculates a blended average of all purchases and uses that as the basis for all sales. Most individual retail investors use average cost for simplicity. Mutual funds are required to use average cost unless you specify otherwise.
Does averaging down lower my cost basis?▾
Yes. Buying more shares at a lower price mathematically reduces your average cost basis. Example: 100 shares at $100 (basis = $100). Buy 100 more at $60 (basis drops to $80). This is the core mechanic of averaging down — you reduce the price at which you break even. Use our calculator to see exactly how many additional shares lower your basis to your target price.
What is the wash sale rule and how does it affect cost basis?▾
The wash sale rule (IRS) disallows a tax loss deduction if you buy a substantially identical security within 30 days before or after selling at a loss. The disallowed loss is added to the cost basis of the replacement shares, increasing your basis — meaning a higher taxable gain (or lower loss) when you eventually sell. Investors who average down into a losing position must be careful not to trigger wash sales.
Related Tools & Guides
Disclaimer: This calculator is for educational purposes only and does not constitute tax or financial advice. Cost basis rules vary by country. Consult a licensed tax professional or financial advisor for your specific situation.