Capital Gains Basics
A capital gain is the profit when you sell an investment for more than you paid. Here is how gains and losses are calculated, when they are taxed and how losses can offset gains. General education, not tax advice.
Gains happen when you sell
Your capital gain or loss is the sale price minus your cost basis, which is generally what you paid, including commissions. In the U.S., gains are generally taxed only when you sell, called realizing the gain. A stock that has risen but that you still hold has an unrealized gain and is generally not taxed yet.
A simple example
| Item | Amount |
|---|---|
| Bought 100 shares at $50 | $5,000 cost basis |
| Sold 100 shares at $80 | $8,000 proceeds |
| Capital gain | $3,000 |
| If sold at $30 instead | $2,000 capital loss |
Hypothetical example; commissions ignored.
Losses offset gains
Capital losses first offset capital gains. If losses exceed gains, you can generally deduct up to $3,000 a year against ordinary income ($1,500 if married filing separately) and carry the rest forward to future years. Selling losers to offset gains is called tax-loss harvesting.
Where you hold investments changes how they are taxed.
Where gains are not taxed yearly
- Trades inside IRAs and 401(k)s are generally not taxed when made.
- Traditional accounts tax withdrawals later; Roth withdrawals can be tax-free if rules are met.
- Inherited investments generally get a “stepped-up” basis equal to their value at death.
- State income taxes vary; some states have none.
Key takeaways
- Capital gain equals sale price minus cost basis.
- Gains are generally taxed only when you sell.
- Losses offset gains, plus up to $3,000 of other income a year.
- Retirement accounts shelter trades from yearly taxes.