Understanding cost basis
Learn how cost basis works, including FIFO calculations, realized vs unrealized gains, and tax implications.
Cost basis is fundamental to understanding your investment returns and calculating taxes. This guide explains how it works in TrackMyShares.
What is cost basis?
Cost basis is what you paid for your shares, including:
- Purchase price
- Brokerage fees
- Any other acquisition costs
It's the baseline for calculating whether you made or lost money when you sell.
Example
You buy 100 shares at $50 with a $10 fee:
- Share cost: 100 × $50 = $5,000
- Total cost basis: $5,000 + $10 = $5,010
- Cost per share: $50.10
Calculating gains and losses
When you sell, your gain or loss is:
Gain/Loss = Sale proceeds - Cost basis
Example
You sell those 100 shares at $60 with a $10 fee:
- Sale proceeds: 100 × $60 - $10 = $5,990
- Cost basis: $5,010
- Capital gain: $5,990 - $5,010 = $980
FIFO method
FIFO (First In, First Out) determines which shares are sold when you don't sell everything.
How it works
The oldest shares (first purchased) are sold first.
Example with multiple lots
You bought Apple shares in three purchases:
| Date | Quantity | Price | Cost basis |
|---|---|---|---|
| Jan 1 | 50 | $140 | $7,000 |
| Mar 1 | 30 | $150 | $4,500 |
| May 1 | 20 | $160 | $3,200 |
Total: 100 shares, $14,700 cost basis
Now you sell 60 shares at $170:
Using FIFO:
- Sell all 50 shares from Jan 1 (cost: $7,000)
- Sell 10 shares from Mar 1 (cost: $1,500)
Sale calculation:
- Proceeds: 60 × $170 = $10,200
- Cost basis: $7,000 + $1,500 = $8,500
- Capital gain: $1,700
Remaining:
- 20 shares from Mar 1 at $150 ($3,000)
- 20 shares from May 1 at $160 ($3,200)
- Total: 40 shares, $6,200 cost basis
Realized vs unrealized gains
Understanding the difference is important for tax planning.
Unrealized gains (paper gains)
Gains on shares you still hold. Your holdings have increased in value, but you haven't sold.
- Not taxable until you sell
- Can decrease if prices fall
- Shown as "gain/loss" on your holdings
Realized gains
Gains from shares you've actually sold. These are "locked in."
- Taxable in the year you sell
- Can't change once sold
- Shown in your transaction history and tax reports
Impact of stock splits
Stock splits change your quantity and cost per share, but not your total cost basis.
Example: 4:1 split
Before split:
- 100 shares at $400 cost per share
- Total cost basis: $40,000
After split:
- 400 shares at $100 cost per share
- Total cost basis: $40,000 (unchanged)
TrackMyShares automatically adjusts your cost basis when you record a split.
Tax considerations
Disclaimer: This is general information only. Consult a tax professional for advice specific to your situation.
Short-term vs long-term
In many jurisdictions, how long you hold shares affects your tax rate:
- Short-term — Held less than 12 months, taxed at higher rates
- Long-term — Held more than 12 months, often lower tax rates
FIFO impacts this because it sells your oldest shares first, which are more likely to qualify for long-term rates.
CGT discount (Australia)
In Australia, assets held over 12 months may qualify for a 50% CGT discount (for individuals). TrackMyShares calculates this automatically in tax reports.
Wash sale rules (US)
In the US, you can't claim a loss if you buy the same stock within 30 days. TrackMyShares flags potential wash sales in your reports.
Viewing your cost basis
To see cost basis for any holding:
- Click on the holding in your portfolio
- View the Cost basis section showing:
- Total cost basis
- Average cost per share
- Breakdown by lot (if transaction-based)
For transaction-based portfolios, you can see each lot's purchase date and cost.
Adjusting cost basis
Sometimes you need to adjust cost basis:
- Spin-offs — Allocate basis between parent and spin-off
- Mergers — Convert basis to new shares
- Return of capital — Reduce basis by non-dividend distributions
You can manually edit transactions to adjust cost basis when needed.