Stock Cost Basis Calculator
Cost basis is the original purchase price of an investment, including commissions and fees, used to calculate capital gains or losses when you sell. This calculator lets you enter up to three purchase lots with individual share counts, purchase prices, and commissions. It then computes the total cost, total shares, and the average per-share cost basis. Knowing your cost basis is essential for accurate tax reporting. Your broker reports covered security basis on Form 1099-B, but for older or transferred positions you may need to calculate it yourself using the method shown here.
Cost basis formula
Total cost = sum of (shares(i) * price(i) + commission(i))
Total shares = sum of shares(i)
Per-share basis = Total cost / Total shares
Each lot's cost is the number of shares multiplied by the purchase price, plus any commission paid for that purchase. The average cost basis divides the total cost across all shares held.
Using cost basis at tax time
- Capital gain or loss = sale proceeds minus cost basis (and minus sale commission).
- Short-term gains (held 1 year or less) are taxed as ordinary income; long-term gains (held more than 1 year) qualify for preferential rates.
- IRS Publication 550 covers investment income and expenses including cost basis rules.
- If you received shares as a gift or inheritance, special rules apply; consult IRS Publication 550 or a tax advisor.
- Wash sale rules may disallow a loss if you repurchase substantially identical shares within 30 days before or after the sale.
Frequently asked questions
What is cost basis?
Cost basis is the original value of an asset for tax purposes. For stocks it is typically the purchase price per share plus any commissions paid. When you sell, you subtract your cost basis from the sale proceeds to determine your capital gain or loss.
How do commissions affect cost basis?
Commission paid at purchase is added to the total cost and therefore increases the per-share cost basis. A higher cost basis reduces your taxable capital gain when you sell. Commission paid at sale is subtracted from proceeds, not added to basis.
What is the difference between FIFO and average cost?
FIFO (first in, first out) assumes you sell your earliest-purchased shares first. Average cost divides total cost by total shares. The IRS allows both methods; average cost is commonly used for mutual funds. This calculator shows average cost basis across all lots entered.
Does stock splits affect cost basis?
Yes. After a stock split you have more shares at a lower price per share. The total cost basis stays the same, but the per-share basis is divided by the split ratio. For example, after a 2-for-1 split, a $100 per-share basis becomes $50.
Where can I find my cost basis?
Brokers are required to report cost basis to the IRS on Form 1099-B for covered securities (purchased after 2011 for equities). Check your broker account statements or 1099-B. The IRS Publication 550 covers investment income and basis rules.
Official sources
- IRS Publication 550: Investment Income and Expenses.
- IRS: Topic 703 - Basis of Assets.
Reviewed by the CalculatorHub team, edited by James Graham, 15 June 2026. See our methodology.