Selling a stock, ETF, rental property, or cryptocurrency for a profit triggers capital gains tax. Most investors celebrate the gain but forget to reserve cash for the IRS. Then they scramble at tax time.
Know your capital gains exposure before you hit sell. It is the difference between a profitable trade and an unpleasant surprise.
Key Takeaways
- Short-term gains (held under 1 year) are taxed as ordinary income. Up to 37%.
- Long-term gains (held 1+ year) are taxed at preferential rates of 0%, 15%, or 20%.
- Your total income in the sale year determines which rate you pay. Not just the gain itself.
- Tool: Calculate your capital gains tax now →
Short-Term vs. Long-Term: The Holding Period That Determines Your Rate
The single most impactful variable in capital gains tax is how long you held the asset. The IRS draws a hard line at one year.
Short-Term Capital Gains (Held Under 12 Months)
Short-term gains are taxed as ordinary income. The gain stacks on top of your W-2 wages and is taxed at your marginal bracket. That rate could be 22%, 24%, 32%, or as high as 37% for high earners.
Example: You bought a stock in January and sold it in September for a $25,000 gain. If you are in the 24% bracket, you owe $6,000 to the IRS. That trade just cost you nearly a quarter of its value.
Long-Term Capital Gains (Held 12+ Months)
Hold the same asset for one year and one day, and the IRS rewards your patience with dramatically lower rates:
| Filing Status | 0% Rate | 15% Rate | 20% Rate |
|---|---|---|---|
| Single | ≤ $47,025 | $47,026–$518,900 | > $518,900 |
| Married Filing Jointly | ≤ $94,050 | $94,051–$583,750 | > $583,750 |
The 0% bracket is real. Single filers with total income at or below $47,025, including the capital gain, pay zero federal capital gains tax on long-term investments. This is one of the most powerful strategies available to early retirees and investors in low-income years.
How Capital Gains Tax Is Actually Calculated
The capital gains rate does not apply to a flat slice of your income. It applies to the gain stacked on top of your existing taxable income.
Step-by-Step Calculation:
- Calculate your regular taxable income after deductions
- Add your capital gain to that income
- The gain is taxed at the rate applicable to where it lands in the brackets
Example:
- Married couple, combined W-2 income: $85,000
- Long-term capital gain: $40,000
- Total income: $125,000
- The 0% bracket covers long-term gains up to $94,050. But $85,000 of ordinary income already fills that space. The full $40,000 gain is taxed at 15%
- Capital gains tax owed: $40,000 × 15% = $6,000
Use our Capital Gains Calculator to model your exact scenario. Enter your purchase price, sale price, filing status, and other income to get a precise after-tax return.
Tax-Loss Harvesting: How to Offset Capital Gains
You do not have to absorb a large capital gains tax bill without a strategy. Tax-loss harvesting means selling losing positions in the same tax year to offset realized gains.
How it works:
- You realize a $30,000 capital gain on investment A
- You sell investment B for a $12,000 loss
- Your net capital gain for tax purposes: $30,000 − $12,000 = $18,000
- You avoided paying tax on $12,000 of gains
Unused capital losses carry forward indefinitely to offset future gains. If your losses exceed your gains by more than $3,000, you can deduct up to $3,000 against ordinary income each year.
The Net Investment Income Tax (NIIT) Hidden Surcharge
High-income investors face an additional 3.8% surcharge on investment income called the Net Investment Income Tax. This applies when your Modified Adjusted Gross Income (MAGI) exceeds:
- $200,000 for single filers
- $250,000 for married filing jointly
The effective top marginal long-term capital gains rate for high earners is 23.8% (20% + 3.8%), not 20%.
Strategic Timing: When to Sell Matters as Much as What to Sell
The tax code gives you significant control over when you realize gains. Three high-leverage timing strategies stand out.
Sell in low-income years. If you are between jobs, taking a sabbatical, or recently retired before Social Security begins, your income may temporarily fall into the 0% long-term gains bracket.
Spread gains across tax years. If you are near a bracket threshold in December, consider selling part of a position in late December and the rest in early January. Splitting the gain across two tax years can keep each portion in a lower bracket.
Pair with Roth conversions. The same low-income years that produce 0% capital gains rates also allow you to convert traditional IRA funds to a Roth IRA at a lower tax cost. See our Roth Conversion Calculator.
Frequently Asked Questions
Do I pay state capital gains tax too? Most states tax capital gains as ordinary income. California has no preferential rate. Capital gains are taxed at up to 13.3%. States like Texas, Florida, Nevada, and Washington have no income tax at all. Always factor your state tax into the total cost of selling.
What cost basis should I use? Your cost basis is what you originally paid for the asset, including commissions. If you received shares through a company stock plan such as RSUs or an ESPP, the basis is typically the fair market value on the vesting or purchase date. Incorrect basis calculations are one of the most common and expensive investor mistakes.
Does cryptocurrency trigger capital gains tax? Yes. The IRS treats cryptocurrency as property. Every trade, sale, or conversion is a taxable event, including swapping one crypto for another. Your gain or loss is the difference between what you paid and what the asset was worth when you sold.
Results are estimates for informational purposes only. Consult a licensed financial professional before making financial decisions.
You Might Also Like
Put These Numbers to Work
Open a Fidelity brokerage account. $0 commissions, no account minimums, fractional shares available.
Affiliated. We may earn a commission.
Related Guides
Free Tools
Run the actual numbers
Stop estimating. Plug in your numbers and get a precise answer in seconds. Free, no signup required.
Open the Capital Gains Calculator


