Cost Basis Calculator

Calculate the cost basis of your investments for accurate capital gains calculation and tax reporting.

SC
Written by Sarah Chen, CFP
Certified Financial Planner
JW
Fact-checked by Dr. James Wilson, PhD
Options Strategy Researcher
Profit & LossFact-Checked

Input Values

$

Price per share of first lot.

Number of shares in first lot.

$

Price per share of second lot.

Number of shares in second lot (0 if only one purchase).

$

Total commissions across all purchases.

Results

Average Cost Basis
$0.00
Total Cost
$0.00
Total Shares0
FIFO (First Lot Cost)$0.00
LIFO (Last Lot Cost)$0.00
Results update automatically as you change input values.

What Is Cost Basis?

Cost basis is the original value of an investment for tax purposes, typically the purchase price plus commissions and fees. When you sell an investment, your capital gain or loss is calculated by subtracting the cost basis from the sale price. An accurate cost basis ensures you pay the correct amount of capital gains tax, no more and no less.

Cost basis becomes more complex when you make multiple purchases at different prices (dollar-cost averaging), receive stock dividends, undergo stock splits, or reinvest distributions. This calculator helps you determine your cost basis using the most common methods: average cost, FIFO, and specific lot identification.

i
Why Cost Basis Matters for Taxes

A wrong cost basis directly causes you to pay incorrect taxes. If your actual cost basis is $47.33 but you report $45.00, you will pay tax on an extra $2.33 per share of phantom gain. On 150 shares at 15% tax rate, that is an extra $52 in unnecessary taxes.

Cost Basis Calculation Methods

Average Cost Basis
Average Cost = Total Cost of All Purchases / Total Shares
Where:
Total Cost = Sum of (price × shares) for all lots plus commissions
Total Shares = Total number of shares owned
Capital Gain from Cost Basis
Capital Gain = (Sale Price - Cost Basis) × Shares Sold
Where:
Sale Price = Price received per share
Cost Basis = Your cost per share (varies by method)
Shares Sold = Number of shares sold
Cost Basis Calculation Example
Given
First Purchase
100 shares at $45
Second Purchase
50 shares at $52
Commissions
$0
Calculation Steps
  1. 1Total cost = (100 × $45) + (50 × $52) = $4,500 + $2,600 = $7,100
  2. 2Total shares = 100 + 50 = 150
  3. 3Average cost basis = $7,100 / 150 = $47.33 per share
  4. 4FIFO basis (first lot sold first) = $45.00
  5. 5LIFO basis (last lot sold first) = $52.00
  6. 6If selling 50 shares at $55:
  7. 7 Average method: Gain = ($55 - $47.33) × 50 = $383.50
  8. 8 FIFO method: Gain = ($55 - $45) × 50 = $500
  9. 9 LIFO method: Gain = ($55 - $52) × 50 = $150
Result
Average cost basis is $47.33 per share. Depending on the method used, selling 50 shares at $55 generates $150 (LIFO) to $500 (FIFO) in capital gains. LIFO minimizes current taxes in this scenario.

Cost Basis Methods Compared

Cost Basis Method Comparison
MethodHow It WorksBest ForIRS Rules
Average CostTotal cost / total sharesMutual funds, simple trackingAllowed for mutual funds; brokers may offer for stocks
FIFO (First In, First Out)Oldest shares sold firstDefault method if none specifiedIRS default for stocks
LIFO (Last In, First Out)Newest shares sold firstMinimizing gains when recent buys are higherMust specify; not default
Specific Lot IDYou choose which shares to sellMaximum tax flexibilityMust identify at time of sale

How to Track Cost Basis

1
Record Every Purchase
For each buy, record date, number of shares, price per share, and commissions. This creates your lot-by-lot record.
2
Adjust for Corporate Actions
Stock splits, reverse splits, spin-offs, and mergers change your cost basis. A 2:1 split doubles shares and halves cost basis per share.
3
Track Reinvested Dividends
If you reinvest dividends, each reinvestment is a new purchase lot with its own cost basis. Missing these overstates your gain and taxes.
4
Report Correctly at Sale
When selling, calculate gain using your chosen method (average, FIFO, specific lot). Report on Schedule D and Form 8949.
  • Brokers report cost basis to the IRS for stocks purchased after 2011
  • Reinvested dividends increase your cost basis (reducing future taxable gains)
  • Stock splits change shares and per-share basis but not total basis
  • Gifted stock: basis is the donor's cost basis (carryover basis)
  • Inherited stock: basis is the fair market value at date of death (step-up)
  • Wash sale adjustments add disallowed losses to the replacement stock's basis
!
Do Not Overlook Reinvested Dividends

If you reinvested $640 in dividends over 3 years, those reinvestments are additional purchase lots that increase your total cost basis. Failing to include them means you pay tax on gains you never actually received. This is one of the most common cost basis errors.

Frequently Asked Questions

For a single purchase: Cost Basis = Purchase Price × Shares + Commissions. For multiple purchases: Average Cost = Total Cost of All Lots / Total Shares. Example: 100 shares at $45 + 50 shares at $52 = $7,100 total / 150 shares = $47.33 average cost basis.

Sources & References

  • U.S. Securities and Exchange Commission (SEC) - Investor Education
  • Options Clearing Corporation (OCC) - Options Education
  • Chicago Board Options Exchange (CBOE) - Options Strategies
  • Hull, J.C. "Options, Futures, and Other Derivatives" (11th Edition, 2021)

Embed This Calculator on Your Website

Free to use with attribution

Copy the code below to add this calculator to your website, blog, or article. A link back to CoveredCallCalculator.net is included automatically.

<iframe src="https://coveredcallcalculator.net/embed/cost-basis-calculator" width="100%" height="500" frameborder="0" title="Cost Basis Calculator" style="border:1px solid #e2e8f0;border-radius:12px;max-width:600px;"></iframe>
<p style="font-size:12px;color:#64748b;margin-top:8px;">Calculator by <a href="https://coveredcallcalculator.net" target="_blank" rel="noopener">CoveredCallCalculator.net</a></p>