How capital gains tax works
When you sell an asset for more than you paid, the profit is a capital gain. How long you held the asset determines whether the gain is taxed at prefer long-term rates or ordinary income rates.
Short-term vs long-term
- Short-term (held 12 months or less): taxed as ordinary income at your marginal rate (10%–37%).
- Long-term (held more than 12 months): taxed at preferential rates of 0%, 15%, or 20% depending on your total taxable income.
2025 long-term brackets (single filer)
- 0% rate: taxable income up to $48,350
- 15% rate: $48,351 to $533,400
- 20% rate: above $533,400
Higher-income filers may also owe the 3.8% Net Investment Income Tax (NIIT) on investment income above $200,000 (single) or $250,000 (married filing jointly). This calculator provides a simplified federal estimate; state taxes and NIIT are not included.
Tax-loss harvesting — selling losing positions to offset gains — can dramatically reduce your capital gains tax bill. Each year you can deduct up to $3,000 of net capital losses against ordinary income.
Frequently asked questions
How is the holding period calculated?
The holding period starts the day AFTER you acquire the asset and ends on the day you sell it. To qualify for long-term rates, you must hold the asset for more than 365 days — 364 days is short-term.
What is tax-loss harvesting?
Selling investments at a loss to offset capital gains. You can deduct up to $3,000 of net capital losses against ordinary income each year, with unlimited carryforward to future years.
Does this include the Net Investment Income Tax (NIIT)?
No. The 3.8% NIIT applies to investment income for singles with MAGI above $200,000 or married couples above $250,000. Add 3.8% to your long-term rate if your income exceeds these thresholds.
Are crypto gains taxed the same as stocks?
Yes. The IRS treats cryptocurrency as property for tax purposes. Selling crypto for fiat, trading one crypto for another, or using crypto to purchase goods all trigger capital gains tax.
What is the wash sale rule?
If you sell a security at a loss and buy the same or 'substantially identical' security within 30 days before or after the sale, the loss is disallowed. The disallowed loss is added to your cost basis of the replacement shares.
Can I gift appreciated stock to avoid capital gains tax?
Yes. If you gift appreciated stock to a charity, you deduct the full fair market value AND pay no capital gains tax. If you gift to an individual, they take your cost basis and may owe tax when they sell.
Do I owe tax if I inherit appreciated stock?
No capital gains tax is due on appreciation during the deceased's lifetime. Heirs get a 'stepped-up basis' — the fair market value on the date of death. This can save heirs enormous amounts in capital gains tax.
Glossary of key terms
- Cost Basis
- What you paid for an asset plus any commissions or fees. Used to calculate gain or loss when you sell.
- Long-term Capital Gain
- Profit from selling an asset held more than one year. Taxed at preferential rates of 0%, 15%, or 20%.
- Short-term Capital Gain
- Profit from selling an asset held one year or less. Taxed as ordinary income at your marginal rate.
- Stepped-up Basis
- When you inherit an asset, your cost basis becomes the fair market value on the date of the previous owner's death, eliminating capital gains tax on lifetime appreciation.
- Wash Sale
- Selling a security at a loss and repurchasing the same security within 30 days. The loss is disallowed and added to the new cost basis.
Common mistakes to avoid
- Selling just before the one-year mark — waiting a few extra days can cut your tax rate from 22%+ to 15%
- Forgetting to account for reinvested dividends in cost basis (they increase your basis, reducing gains)
- Triggering wash sales by automatically reinvesting in the same fund after tax-loss harvesting
- Not realizing that mutual fund distributions are taxable even if you didn't sell any shares
- Ignoring state capital gains taxes — most states tax capital gains as ordinary income (California's top rate is 13.3%)
Pro tips
- Hold appreciated assets for 13+ months before selling to lock in long-term rates (0%, 15%, or 20% vs. up to 37%).
- Donate appreciated stock directly to charity instead of selling first — you avoid capital gains tax AND get a deduction for full fair market value.
- Use specific share identification (vs. FIFO) when selling partial positions to cherry-pick the highest-basis shares and minimize gains.
- In retirement, prioritize pulling from taxable accounts in years when you're in the 0% long-term bracket — effectively tax-free gains.
- Harvest gains in low-income years (e.g., early retirement) to lock in the 0% long-term rate on significant appreciation.
Results are estimates for educational purposes only and not financial advice. Consult a licensed professional for advice specific to your situation.