Need to calculate cost basis for a position but unsure how?  Here’s the math.

Cost basis is defined as the original price of an asset.  It is the number used in determining capital gains. Cost basis is usually the purchase price including all fees, but it can be complicated when there are multiple trade lots, reinvested dividends, splits and sells.

The cost basis of a position =

  • Cost of purchases including all fees + Dollar amount of reinvested shares – Cost of any shares sold
  • Cost of shares sold is the percentage of shares sold times the total cost basis.
  • Cost basis does not include dividends paid to cash, but it does include reinvested dividends.

For example

Let’s say Mrs. Happyclient bought 100 shares of  Acme Corp for $5000 (or $5/share). It splits 2 for 1, so she now owns 1000 shares with a cost basis of $5000. Now she sells 200 shares. (It doesn’t matter how much she sold them for.)
The cost basis of the 200 sold =

  • (# of shares sold / total shares before sell) * total cost basis
  • OR  (200 /1000) * 5000  = $1000

Subtracting the cost of the shares sold ($1000) from the total ($5000) gives you the cost basis of the remaining 800 shares ($4000).


Schwab Cost Basis Overview
TD Ameritrade Cost Basis information
Fidelity Institutional Wealth Services Cost Basis Overview
T.Rowe Price Cost Basis Accounting & Calculation
Careful records can result in capital gains