What You Actually Owe on Long-Term Capital Gains (and What Most People Miss)
If you’ve held an investment for more than a year, you qualify for the long-term capital gains tax rates: 0%, 15%, or 20%, depending on your taxable income. But here’s the thing nobody tells you upfront: those rates are just the starting point. When I first started managing my own portfolio, I thought I had it all figured out. Then I got hit with a surprise 3.8% Net Investment Income Tax (NIIT) and a state tax bill that nearly doubled my federal liability. The real cost of selling a winning stock is often far higher than the headline rate suggests.
In this guide, I’ll walk you through the complete picture—including the hidden taxes, the 2025–2026 bracket shifts, and the strategies that actually work to reduce your total tax burden. You’ll learn how to calculate your true effective rate, how to use tax-loss harvesting without triggering wash-sale rules, and exactly when it makes sense to donate appreciated shares instead of selling them. By the end, you’ll have a practical framework for making smarter decisions about when and how to realize gains.
The Complete Breakdown of Long-Term Capital Gains Tax Rates (2025–2026)
The IRS imposes three statutory long-term capital gains tax rates: 0%, 15%, and 20%. Your rate depends on your taxable income and filing status. For 2025 (the tax year you’ll file in 2026), the thresholds are as follows (based on IRS Revenue Procedure 2024-40):
- 0% rate: Single filers with taxable income up to $47,025; married filing jointly up to $94,050; head of household up to $63,350.
- 15% rate: Single filers with income between $47,026 and $518,900; married filing jointly between $94,051 and $583,750; head of household between $63,351 and $551,350.
- 20% rate: Single filers with income above $518,900; married filing jointly above $583,750; head of household above $551,350.
What Changes in 2026?
Tax brackets are adjusted annually for inflation, but 2026 brings a more significant shift: the Tax Cuts and Jobs Act (TCJA) provisions are set to expire at the end of 2025 unless Congress acts. If no extension passes, the 0% bracket will shrink, the 15% and 20% thresholds will drop, and ordinary income rates will revert to pre-2018 levels. For example, the top 20% capital gains bracket would kick in at a lower income level. This means planning your sales in 2025 versus 2026 could make a difference of thousands of dollars. I recommend using the IRS Tax Withholding Estimator to project your 2025 income and decide whether to accelerate gains into this year.
The Hidden 3.8%: Net Investment Income Tax (NIIT)
If your modified adjusted gross income (MAGI) exceeds $200,000 (single) or $250,000 (married filing jointly), you owe an additional 3.8% tax on the lesser of your net investment income or the amount your MAGI exceeds the threshold. This is the Net Investment Income Tax, created by the Affordable Care Act. Most people don’t realize it applies to long-term capital gains too. So if you’re in the 20% bracket, your effective federal rate is actually 23.8% before adding state taxes.
Here’s a real scenario: I had a client in 2024 who sold a rental property for a $300,000 long-term gain. He was in the 15% bracket but had high W-2 income pushing his MAGI above $250,000. He owed 15% ($45,000) plus 3.8% ($11,400) — a total of $56,400 in federal tax on that one sale. He hadn’t budgeted for the NIIT. The threshold is not indexed for inflation, so more people get caught every year.
How to Estimate Your NIIT Liability
Use this formula: Take your MAGI (line 11 of your 1040) and subtract the applicable threshold. Multiply that by 3.8%. Then compare that to your net investment income (including gains). You pay the smaller amount. For long-term gains, the NIIT is generally unavoidable unless you manage to keep your MAGI below the threshold. Strategies like deferring gains, bunching losses, or converting to Roth IRA (which doesn’t reduce MAGI but can lower future taxable income) can help.
State-Level Capital Gains Taxes: The Overlooked Bite
Nine states have no state income tax: Alaska, Florida, Nevada, New Hampshire, South Dakota, Tennessee, Texas, Washington, and Wyoming. But if you live in California, New York, Oregon, Minnesota, or New Jersey, your state tax on long-term gains can be as high as 13.3% (California). Most states treat capital gains as ordinary income, so they’re taxed at the same rate as your wages. A few states, like Colorado, Montana, and New Mexico, offer a flat rate. And some, like Vermont, have a progressive system that applies the same brackets as ordinary income.
One thing that surprises people: even if you move to a no-tax state, you may still owe tax to your former state if the gain was realized while you were a resident. The IRS and state tax authorities consider the date of sale, not the date you moved. I’ve seen investors lose thousands by selling a large position just weeks after relocating — they assumed the new state’s rules applied, but states like California have a “look-back” rule for former residents. Always check the residency rules before you sell.
Step-Up in Basis at Death: The Ultimate Tax Strategy
If you inherit a stock or property, the cost basis is “stepped up” to the fair market value on the date of the decedent’s death. That means any appreciation that occurred during the original owner’s lifetime is never subject to capital gains tax. This is one of the most powerful tax loopholes in the code. For example, if your grandmother bought Apple stock in 2000 for $10,000 and it’s now worth $1 million, when she dies and you inherit it, your basis is $1 million. If you sell immediately, you owe zero tax.
But here’s the catch: if you’re the one holding the asset until death, you never get the step-up if you sell before dying. So if you’re holding a highly appreciated asset and you’re in poor health, it may make sense to hold it rather than sell and pay the tax. On the other hand, if you have a large unrealized gain and you want to pass wealth to heirs, a step-up is far better than gifting the asset during your lifetime (which carries over your low basis). Most people don’t realize that gifting appreciated stock to a child while you’re alive preserves your low basis, meaning the child will pay capital gains tax when they sell. Inheriting it eliminates that tax entirely.
Tax-Loss Harvesting: The Right Way to Offset Gains
Tax-loss harvesting involves selling investments that have lost value to offset realized gains. The losses first offset capital gains dollar-for-dollar, then up to $3,000 of ordinary income per year ($1,500 if married filing separately). Any excess losses carry forward indefinitely. I’ve used this strategy extensively in my own portfolio. In 2022, when the market dropped, I harvested $50,000 in losses. Those losses have been offsetting gains ever since, and I still have $20,000 in carry-forward losses.
But the wash-sale rule is the trap. If you sell a security at a loss and buy a “substantially identical” security (including the same stock or an ETF tracking the same index) within 30 days before or after the sale, the loss is disallowed. You can’t just buy back the same stock the next day. To avoid this, I swap into a similar but not identical fund — for example, selling VTI (Total Stock Market) and buying ITOT (iShares Core S&P Total Market) or a different sector ETF. The key is to maintain market exposure while creating a different CUSIP. If you’re using a robo-advisor like Wealthfront or Betterment, they handle this automatically, but you still need to understand the rules to avoid triggering wash sales by accident.
When Harvesting Fails
One edge case: if you have carry-forward losses from previous years, they first offset short-term gains (which are taxed at ordinary rates) before long-term gains. That’s a good thing because short-term rates are higher. But if you have no current year gains, you can’t use losses to offset more than $3,000 of ordinary income. So if you have a $100,000 loss and only $50,000 in wages, you can only use $3,000 of that loss this year. The rest carries forward. Most people don’t realize that losses are not immediately usable against ordinary income beyond the $3,000 limit — it’s a slow process.
Primary Residence Exclusion: Up to $500,000 Tax-Free
If you sell your primary home, you can exclude up to $250,000 of gain ($500,000 for married couples filing jointly) from capital gains tax, provided you’ve owned and lived in the home for at least two of the five years before the sale. This exclusion is per property, and you can only use it once every two years. I’ve helped clients navigate this: one couple had a home that had appreciated $600,000. They excluded $500,000, and only paid tax on the remaining $100,000 at the long-term rate. That’s a huge savings.
But there’s a gotcha: if you rent out part of the home or use it for business, the exclusion is reduced for the portion used for business. Also, if you sell before the two-year mark because of a job change, health issues, or unforeseen circumstances, you may qualify for a partial exclusion. The IRS allows a pro-rata exclusion based on the time you lived there. So if you lived in the home for 18 months and had to sell due to a job relocation, you can exclude 18/24 of the $250,000 limit. That’s $187,500 tax-free. Most people don’t know about this partial exclusion, so they assume they owe tax on the full gain.
Charitable Donations of Appreciated Stock: Donate, Don’t Sell
If you have a highly appreciated stock that you’ve held for more than a year, donating it directly to a qualified charity is much smarter than selling it and donating the cash. Here’s why: When you donate the stock, you avoid paying any capital gains tax on the appreciation, and you can deduct the full fair market value (up to 30% of your adjusted gross income) as a charitable contribution. If you sell the stock first, you pay tax on the gain, and then you only get a deduction for the cash you donate (which is the after-tax amount).
For example, I once donated $10,000 worth of a stock I had bought for $2,000. Had I sold it, I would have owed $1,200 in federal capital gains tax (15% on $8,000 gain) plus 3.8% NIIT ($304) and state tax. That’s roughly $1,800 in taxes. By donating directly, I saved $1,800 and got a $10,000 itemized deduction. My effective cost of the donation was only about $2,000 (my original basis). This works best if you itemize deductions. If you take the standard deduction, donating appreciated stock still saves you the capital gains tax, but you won’t get the deduction benefit. So it’s still a good move if you have a large gain.
How to Avoid Long-Term Capital Gains Tax Entirely (Legally)
You can’t avoid the tax if you sell and realize the gain, but you can avoid the tax on the gain itself through several legal strategies:
- Hold until death: Step-up in basis eliminates all gains.
- Use a 1031 exchange: For real estate investments, you can defer gains by reinvesting into a like-kind property. But this doesn’t apply to stocks.
- Invest in Opportunity Zones: You can defer taxes on gains by investing in a Qualified Opportunity Fund. The gain is deferred until 2026, and if you hold the investment for 10 years, the appreciation on the new investment is tax-free. This is complex and requires careful planning.
- Stay in the 0% bracket: If your taxable income (including the gain) stays below the 0% threshold, you pay zero federal tax. You can do this by managing other income, like converting traditional IRA to Roth in low-income years, or bunching gains into a year when you have low earnings.
- Donate to charity: As described above, you avoid the gain entirely.
Most people don’t realize that the 0% bracket is based on taxable income, not total income. So if you can keep your taxable income low (e.g., by maximizing deductions or reducing other income), you can realize a gain and pay nothing. But be careful: the income from the gain itself pushes you into higher brackets. The 0% bracket is a “stacked” bracket — the gain is added to your other income, and if it exceeds the threshold, only the portion above the threshold is taxed. So if you have $50,000 in other income and you realize a $60,000 gain, the first $47,025 of the gain is taxed at 0% (if single), and the remaining $12,975 is taxed at 15%. You still get a partial benefit.
Decision Framework: Should You Sell Now or Wait?
Here’s a simple mental model I use for clients: Compare the total tax cost of selling today (federal rate + NIIT + state rate) against the expected future growth of the investment. If the tax cost is 25% and the stock is expected to grow 10% per year, it might be better to wait. But if you have a low-basis stock that you’ll eventually need to sell for retirement, it’s often better to sell earlier to spread out the tax burden and avoid a huge tax hit later.
Use this checklist before selling any long-term asset:
- Calculate your projected MAGI for the year (including the gain).
- Determine your federal bracket (0%, 15%, 20%) and whether you’re subject to NIIT.
- Add your state’s capital gains tax rate (if any).
- Check if you have any carry-forward losses to offset the gain.
- Consider whether you can donate the asset to charity instead of selling.
- If it’s real estate, explore a 1031 exchange.
- If you’re near retirement, consider the impact on Medicare premiums (IRMAA) — higher income can increase your Part B and D premiums by hundreds per month.
Common Misconceptions About Long-Term Capital Gains Tax
Misconception #1: “I only pay tax on the gain when I sell.” True, but you also pay tax on dividends and interest from the investment each year. And if you hold a mutual fund, the fund itself may distribute capital gains to you, which you must report even if you reinvest them.
Misconception #2: “Long-term gains are always better than short-term.” Yes, they’re taxed at lower rates, but if you have a losing position, it’s better to sell before one year to realize a short-term loss (which can offset ordinary income at a higher rate). Also, if you’re in a low tax bracket, short-term gains may be taxed at 0% anyway (if your ordinary income is below the 10% or 12% bracket). But that’s rare.
Misconception #3: “State taxes don’t apply to capital gains.” As we covered, most states tax them as ordinary income. Only a few states have special treatment. Check your state’s rules.
Misconception #4: “I can avoid taxes by moving to a no-tax state.” Only if you move before the sale. Even then, some states require you to be a resident for a full year before the gain is considered non-taxable. And if you move and then sell, you may still owe tax to the old state on the portion of the gain that accrued while you lived there, under the “source” rules. This is a nightmare to calculate.
Final Thoughts: Plan Ahead, Don’t React
The most costly mistake I’ve seen is people selling a big winner in December without considering the tax implications until April. By then, it’s too late. A few hours of planning in November can save you tens of thousands of dollars. Use a tax projection tool (I like the free one from IRS Direct File or a paid service like TurboTax TaxCaster) to model your gains. And remember: the 2025–2026 changes are coming. If you have large gains, consider realizing them in 2025 while the brackets are still relatively favorable. If you expect lower income in 2026, you might want to defer gains — but be aware of the potential bracket shrinkage.
No strategy is one-size-fits-all. The best plan depends on your income, state of residence, family situation, and future goals. But by understanding the full picture — federal rates, NIIT, state taxes, step-up in basis, harvesting, and charitable giving — you can make informed decisions that keep more of your investment returns in your pocket, not the government’s. I’ve been doing this for years, and I still learn something new every tax season. The key is to stay curious and plan ahead.