Selling Investments? Here's Exactly How Capital Gains Tax Works
Learn exactly how capital gains tax works when you sell stocks, funds, or property — short-term vs. long-term rates, what triggers a taxable event, and how to keep more of your gains.
You finally did it. You bought a stock or a fund, it went up, and now you're thinking about selling. Maybe you need the cash. Maybe the position got too big. Maybe you're just tired of watching the number go up and down every day like it has a personal grudge against you.
Whatever the reason — before you hit sell, you need to understand capital gains tax. Because the IRS is absolutely going to want a piece of whatever you made, and how much they take depends on decisions you might not even realize you're making.
Here's the part that trips most people up: the tax you owe isn't determined just by how much you made. It's determined by how long you held the investment. That single variable can be the difference between paying 15% and paying 37%. On a $50,000 gain, that's a $11,000 swing. Not pocket change.
Let's break all of this down, piece by piece.
What Is a Capital Gain, Actually?
A capital gain is what you make when you sell an asset for more than you paid for it. That's it. The "capital" just refers to an asset you own — stocks, bonds, mutual funds, ETFs, real estate, crypto, collectibles. If you bought it and it went up and you sold it, you have a capital gain.
The amount you originally paid is called your cost basis — or sometimes just "basis." Your gain is the difference between what you sold it for and your cost basis.
Say you bought 100 shares of a company at $40 each. You paid $4,000. Those shares are now worth $7,000. If you sell, your capital gain is $3,000. That $3,000 is what gets taxed.
One critical thing: you don't owe capital gains tax just because an investment went up. The tax only kicks in when you sell — when you realize the gain. Sitting on a stock that doubled? Zero tax due. The moment you hit sell, the clock starts.
This is why you'll sometimes hear investors talk about "unrealized gains." It means the paper profit exists but hasn't been taxed yet because the position hasn't been closed.
Short-Term vs. Long-Term: The Most Important Distinction
This is where the money is — literally.
The IRS splits capital gains into two categories based on how long you held the asset before selling:
- Short-term capital gains: You held the investment for one year or less. These gains are taxed as ordinary income — the same rate as your salary, wages, or freelance income.
- Long-term capital gains: You held the investment for more than one year (think: one year and one day, minimum). These gains get taxed at preferential lower rates.
Why does the government reward you for holding longer? The policy rationale is that long-term investing is seen as more economically productive than rapid trading. Whether you agree with that or not, the rate difference is real and significant.
Here's what the two structures actually look like side by side:
Short-Term Capital Gains Tax Rates (= Ordinary Income Rates)
Short-term gains are taxed at your marginal income tax bracket. For 2026 — assuming no major tax law changes — that means:
| Ordinary Income Bracket | Tax Rate | Single Filer Income Range |
|---|---|---|
| 10% | 10% | $0 – ~$11,925 |
| 12% | 12% | ~$11,926 – ~$48,475 |
| 22% | 22% | ~$48,476 – ~$103,350 |
| 24% | 24% | ~$103,351 – ~$197,300 |
| 32% | 32% | ~$197,301 – ~$250,525 |
| 35% | 35% | ~$250,526 – ~$626,350 |
| 37% | 37% | Over ~$626,350 |
(These are the 2025 bracket thresholds, which adjust slightly each year for inflation. Always confirm current-year numbers with IRS.gov or your tax software.)
Long-Term Capital Gains Tax Rates
Long-term gains are taxed on their own separate schedule — lower than ordinary income at every level.
| Investor Profile | Long-Term Capital Gains Rate | Single Filer Taxable Income Range |
|---|---|---|
| Low-to-moderate income | 0% | Up to ~$47,025 |
| Middle income | 15% | ~$47,026 – ~$518,900 |
| High income | 20% | Over ~$518,900 |
Notice that 0% bracket. If your total taxable income — including the gain itself — falls below roughly $47,000 as a single filer, you owe nothing on long-term capital gains. This is a legitimate, legal tax planning opportunity that a lot of people completely miss.
The Net Investment Income Tax: Don't Forget This One
Higher earners have an additional consideration. If your modified adjusted gross income (MAGI) exceeds $200,000 for single filers or $250,000 for married filing jointly, a 3.8% Net Investment Income Tax (NIIT) gets stacked on top of your capital gains tax.
That means the effective top rate on long-term capital gains isn't 20%. It's 23.8%. And for short-term gains at the top bracket? You're looking at 40.8% — 37% ordinary income + 3.8% NIIT.
These thresholds aren't adjusted for inflation, by the way. They've been stuck at $200,000/$250,000 since the NIIT was introduced in 2013. Bracket creep is real.
What Actually Triggers Capital Gains Tax
Selling isn't the only thing that can trigger a taxable event. Here's a fuller list:
Things that DO trigger capital gains tax:
- Selling stocks, ETFs, mutual funds, bonds
- Selling real estate (though primary-home exclusions apply — more on that in the FAQ)
- Selling cryptocurrency
- Selling collectibles, art, or precious metals
- Receiving mutual fund distributions (even if you didn't sell shares yourself — this is the one that genuinely shocks people come tax time)
Things that do NOT trigger capital gains tax:
- Holding an appreciated asset without selling
- Transferring investments between accounts at the same brokerage
- Moving money between funds inside a 401(k) or IRA
- Rebalancing inside a tax-advantaged account
That last two points are crucial. Inside a traditional 401(k), Roth IRA, or other tax-advantaged account, you can buy and sell freely without triggering any capital gains event. The tax consequences only happen when money eventually comes out of the account. This is one of the biggest advantages of those accounts that doesn't get talked about enough.
Why the Holding Period Matters So Much (With Real Numbers)
Let's put some concrete numbers to this so it actually hits home.
Imagine you bought $20,000 of shares in a tech-sector ETF. Those shares are now worth $50,000 — a $30,000 gain. You're in the 24% ordinary income bracket.
Scenario A: You sell after 8 months (short-term)
- Tax rate: 24% (ordinary income)
- Tax owed: $7,200
- You keep: $22,800 of the gain
Scenario B: You wait until month 13, then sell (long-term)
- Tax rate: 15% (long-term capital gains)
- Tax owed: $4,500
- You keep: $25,500 of the gain
That five-month wait — just sitting on your hands — saved you $2,700. With nothing extra required from you.
Now, is waiting always the right move? Not necessarily. If you think the position is going to fall significantly in those extra months, taking the tax hit and selling earlier might make more sense. Tax efficiency matters, but it shouldn't override your investment logic entirely. Paying a lower tax rate on a smaller gain (or a loss) because you held too long isn't a win.
There's also something worth watching in volatile markets: when interest rates are elevated and market multiples are under pressure — the kind of environment discussed in posts like The Kevin Warsh Era Begins: Why a 25x Market Multiple Terrifies Me — the calculus on holding vs. selling gets more complicated. A falling share price eats into your gain whether you're optimizing for taxes or not.
Capital Losses: The Silver Lining in a Bad Year
Here's something the tax code actually does in your favor: if you sell an investment at a loss, that loss can offset your gains.
This is called tax-loss harvesting, and it's one of the few genuine tax planning strategies available to regular investors.
Say you made $15,000 on one stock and lost $5,000 on another. You only owe capital gains tax on the net $10,000. If your losses exceed your gains for the year, you can use up to $3,000 of excess losses to offset ordinary income like your salary. Any losses beyond that carry forward to future tax years indefinitely.
There's an important rule to know here: the wash-sale rule. If you sell a security at a loss and buy the same or a "substantially identical" security within 30 days before or after the sale, the IRS disallows the loss. You can't just sell a losing stock, immediately buy it back, and claim the deduction. You have to actually be out of the position for at least 31 days — or buy something different.
In rocky markets — say, when bond yields are spiking and equities are getting hit across the board — tax-loss harvesting can take some of the sting out. The period covered in posts like The Great Credit Squeeze: Why Spiking Yields and Debt Limits Are Hitting Home is exactly the kind of environment when a lot of portfolios are sitting on losses worth harvesting, even if the overall year doesn't feel like a disaster.
Historical Context: Capital Gains Rates Through the Decades
Capital gains tax rates have ranged wildly throughout American history — this isn't a settled, static thing. It's worth knowing where we've been.
| Era | Top Long-Term Capital Gains Rate | Notes |
|---|---|---|
| 1970s | ~35% | Part of high overall tax environment |
| 1978 | 28% | Revenue Act of 1978 cut rates significantly |
| 1981 | 20% | Economic Recovery Tax Act |
| 1987 | 28% | Tax Reform Act of 1986 equalized with income |
| 1997 | 20% | Taxpayer Relief Act restored preferential treatment |
| 2003 | 15% | Bush tax cuts dropped rates; 0% for lower brackets added |
| 2013 | 20% (23.8% with NIIT) | American Taxpayer Relief Act |
| 2026 | 20% (23.8% with NIIT) | Current structure |
The 2003 cuts — dropping the top long-term rate to 15% for over a decade — were a historically unusual period of low capital gains taxation. The current 20% top rate (plus 3.8% NIIT for high earners) represents a partial rollback, but rates remain well below where they were in the 1970s.
The key takeaway from history: these rates change. Depending on what Congress does with tax legislation, the entire structure could look different within a few years. Building a portfolio and a tax strategy that's somewhat resilient to rate changes — leaning on tax-advantaged accounts, being thoughtful about realized gains — is generally a sounder approach than trying to time the tax code.
How This Connects to Bigger Market Forces
Capital gains taxation doesn't exist in a vacuum. It interacts with everything else going on in markets.
When interest rates rise sharply, the calculus around selling appreciated investments shifts. Higher yields on bonds and CDs — like the environment some investors have been chasing during the hawkish Fed cycles we've seen recently — make it tempting to rotate out of equities and into fixed income. But rotating means realizing gains, which means a tax bill.
Similarly, when the stock market sells off hard — as it did during the kind of environment documented in posts like The S&P 500's "Toxic Cocktail" and the Fed's White House Makeover — some investors panic-sell positions they'd otherwise have held. Selling in a panic isn't just bad for your returns; if those positions had gains, it also accelerates your tax liability.
And on the flip side, when inflation is running hot and eroding purchasing power — the scenario described in posts like The 3.8% Resurgence: Why Wall Street Is Partying While the American Consumer Breaks — some investors think about selling real assets or equities to fund living expenses. Again: taxable event, and you need to plan around it.
The point is that your tax situation is part of your investment situation. They're not separate.
Actionable Things to Think About for Your Own Situation
None of this is personalized financial advice — you should work with a tax professional for anything complex. But here's a framework that holds up year after year:
1. Know your holding period before you sell. Check when you bought the position. If you're weeks away from the one-year mark, it's often worth waiting.
2. Use tax-advantaged accounts for active trading. If you're the type who rebalances frequently or likes to trade, do it inside your IRA or 401(k) where gains don't trigger annual tax bills.
3. Look for harvesting opportunities in down years. Losing positions aren't just painful — they're useful. Use them to offset gains elsewhere in your portfolio.
4. Keep track of your cost basis. Brokerages are required to report this to the IRS, but you should double-check. For positions that predate electronic record-keeping, you may need to reconstruct it yourself.
5. Think about sequencing. If you're in a low-income year — between jobs, early in retirement, taking a sabbatical — that might be the ideal time to realize long-term gains at the 0% or 15% rate rather than waiting until a higher-income year.
FAQ
When do I actually pay capital gains tax?
You pay it when you file your annual tax return for the year in which you sold the investment. If you sell a stock in March 2026, report it on your 2026 tax return, filed by April 2027. However, if your capital gains are large enough that you'd owe more than $1,000 in taxes, you may be required to make quarterly estimated tax payments throughout the year to avoid underpayment penalties. The IRS doesn't just let you sit on that liability interest-free all year.
Do I owe capital gains tax if I sell my house?
Selling your primary residence is treated differently from selling stocks. The IRS allows single filers to exclude up to $250,000 of gain from the sale of a primary home, and married couples filing jointly can exclude up to $500,000 — provided you've owned the home and lived in it as your primary residence for at least two of the five years leading up to the sale. Any gain beyond those exclusion limits is taxed as a long-term capital gain (assuming you've owned the home more than a year). Investment properties and second homes don't get this exclusion.
Does selling crypto trigger capital gains tax?
Yes — cryptocurrency is treated as property by the IRS, not currency, so the exact same rules apply. Sell Bitcoin after holding it more than a year? Long-term capital gains rates. Sell after holding 11 months? Short-term rates — taxed as ordinary income. Even swapping one cryptocurrency for another is technically a taxable event, because you're disposing of one asset and acquiring another. This catches a lot of people off guard.
What happens if I sell at a loss?
A capital loss offsets capital gains dollar-for-dollar. Long-term losses first offset long-term gains; short-term losses first offset short-term gains. Any remaining net loss can offset the other type of gain, and if your total losses still exceed your total gains, you can deduct up to $3,000 against ordinary income per year. Losses beyond that carry forward to future years indefinitely. Just watch the wash-sale rule — you can't sell at a loss and immediately buy back the same security.
Can I gift appreciated stock instead of selling it to avoid capital gains?
Yes, and it's one of the more underused strategies out there. If you donate appreciated stock directly to a qualified charity, you avoid paying capital gains on the appreciation and you get a charitable deduction for the full fair market value of the shares (subject to AGI limits). You come out better than if you'd sold the stock, paid the tax, and then donated cash. For gifts to individuals — like giving appreciated stock to a family member — the recipient takes on your cost basis and holding period, so the gain isn't eliminated, just transferred. The IRS calls this a "carryover basis."
| Scenario | Rate Type | Tax Rate | Approx. Income Threshold |
|---|---|---|---|
| Short-term gain, low income | Ordinary income | 10–12% | Under ~$48,475 |
| Short-term gain, mid income | Ordinary income | 22–24% | $48,476 – $197,300 |
| Short-term gain, high income | Ordinary income | 32–37% | Over $197,301 |
| Long-term gain, low income | Preferential | 0% | Under ~$47,025 |
| Long-term gain, mid income | Preferential | 15% | ~$47,026 – $518,900 |
| Long-term gain, high income | Preferential | 20% (23.8% with NIIT) | Over ~$518,900 |
| Era / Year | Top LT Capital Gains Rate | Key Legislation |
|---|---|---|
| 1970s | ~35% | High overall tax environment |
| 1978 | 28% | Revenue Act of 1978 |
| 1981 | 20% | Economic Recovery Tax Act |
| 1987 | 28% | Tax Reform Act of 1986 |
| 1997 | 20% | Taxpayer Relief Act |
| 2003–2012 | 15% | Bush-era tax cuts |
| 2013–present | 20% (23.8% with NIIT) | American Taxpayer Relief Act + ACA |