I sold my first profitable stock position in 2019 — a $380 gain on shares I’d held for seven months. I was thrilled until I realized I had no idea what I owed in taxes, when I owed it, or whether I’d done something wrong by selling when I did. The 1099-B form arrived in January, and I spent three hours Googling whether that $380 was going to cost me $50 or $150.

The short answer

When you sell an investment for more than you paid, the profit is a capital gain and you owe federal income tax on it. How much you ow depends on how long you held the asset: more than one year gets you a lower “long-term” rate (0%, 15%, or 20% depending on your income), while one year or less gets taxed as ordinary income at your regular tax bracket (potentially 22% to 37%).

Long-term vs short-term capital gains

The IRS draws a bright line at the one-year mark. Buy a stock on March 15, 2025 and sell it on March 16, 2026 or later, and it’s a long-term gain. Sell it before that mark, and it’s short-term — taxed as ordinary income.

Here’s what that looks like in real numbers for 2025:

Long-term capital gains rates (held more than one year):

  • 0% rate: singles earning up to $47,025; married filing jointly up to $94,050
  • 15% rate: singles earning $47,025–$518,900; married filing jointly $94,050–$583,750
  • 20% rate: singles over $518,900; married filing jointly over $583,750

Short-term capital gains rates (held one year or less): Taxed at your ordinary income rate — 10%, 12%, 22%, 24%, 32%, 35%, or 37% depending on total income.

Let’s say you sold $5,000 worth of stock you’d held for 18 months. You’re single, earning $75,000 a year. That $5,000 gain gets taxed at 15% long-term rate: you owe $750 in federal tax.

Now rewind and assume you sold after just 10 months. Same $5,000 gain, same $75,000 income. That gain now gets taxed at your marginal rate — 22% — so you owe $1,100. Holding two more months would have saved you $350.

This is why investment tax efficiency matters. It’s not about timing the market or chasing returns — it’s about understanding that the IRS penalizes short holding periods, sometimes significantly.

What counts as a capital gain

Calculator positioned next to financial tax documents and forms on desk
Photo by Leeloo The First on Pexels

A capital gain happens when you sell an investment — stock, mutual fund, ETF, bond, cryptocurrency, real estate, collectibles — for more than your “cost basis” (what you originally paid, including fees). If you bought 10 shares of a fund at $50 each ($500 total) and sold them for $700, your gain is $200.

Dividends and interest are not capital gains. Those get reported separately and taxed as ordinary income (or qualified dividend rates, which work differently). You only owe capital gains tax when you sell and lock in a profit.

Holding an investment that’s gone up in value but you haven’t sold yet? That’s an unrealized gain. The IRS doesn’t tax it until you sell. I’ve held one position that’s up 40% for three years — I owe nothing on it until I hit the sell button.

State taxes and the 3.8% Medicare surtax

The rates I mentioned above are federal only. Your state likely has its own rules. Nine states — Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, Wyoming, and New Hampshire (on most income) — have no state income tax, so capital gains aren’t taxed at the state level. The other 41 states tax capital gains as regular income, with rates ranging from around 3% to over 13% depending on where you live.

That means a $5,000 long-term gain taxed at 15% federally could actually cost you $750 (federal) + $0–$650 (state) depending on your state’s rate.

If you’re a high earner — modified adjusted gross income over $200,000 for singles or $250,000 for married couples filing jointly — you may also owe the Net Investment Income Tax (NIIT), an additional 3.8% on your investment income including capital gains. So a long-term gain taxed at 15% federally becomes 15% + 3.8% = 18.8% total, before state taxes.

This threshold hasn’t been adjusted for inflation since 2013, which means more people hit it every year without realizing it’s coming.

Capital losses can offset gains — but watch the wash-sale trap

Hand marking a calendar date to show the one-year investment holding period
Photo by SHVETS production on Pexels

If you sell an investment at a loss, that loss can offset your gains. Sold one stock for a $3,000 gain and another for a $2,000 loss? You only owe tax on the net $1,000 gain.

If your losses exceed your gains in a given year, you can deduct up to $3,000 of that excess loss against your ordinary income. Anything beyond $3,000 carries forward to future years indefinitely. I sold a speculative position at a $1,200 loss in 2020 — I used that to offset some gains that year, and it lowered my taxable income by the remainder.

This is the basis for a strategy called tax-loss harvesting: intentionally selling losing positions near year-end to offset gains and reduce your tax bill. Some investors use this every year.

Here’s where DIY tax-loss harvesting goes wrong: the wash-sale rule disallows your loss deduction if you buy the same security — or a “substantially identical” one — within 30 days before or after the sale. That 30-day window runs both directions. Sell a stock at a loss on December 15, then buy it back on December 20? The loss is disallowed. Buy shares on November 10, sell at a loss on December 5, then your brokerage’s dividend reinvestment plan buys more shares on December 10? Also disallowed.

The loss doesn’t vanish forever — it gets added to the cost basis of the replacement shares, so you’ll eventually benefit when you sell those — but you lose the immediate tax deduction you were counting on. According to IRS Publication 550, “substantially identical” is determined case-by-case, but it generally includes the same stock, same bond issuer, or same index fund family. Selling one S&P 500 index fund and buying a different S&P 500 fund from another provider might be considered substantially identical. Selling a tech stock and buying a completely different sector? Usually safe.

I’ve never harvested losses myself because I’m worried about triggering a wash sale accidentally. If you’re considering it, map out your trades on a calendar and ask your tax preparer to review them before you file.

The inheritance loophole most people miss: stepped-up basis

When you inherit an investment — stock, real estate, a mutual fund account — your cost basis resets to the asset’s fair market value on the date the previous owner died. This is called stepped-up basis, and it’s one of the largest tax advantages in the code.

Here’s what that means: your grandmother bought 500 shares of a stock in 1985 for $5,000. When she passed away in 2025, those shares were worth $150,000. You inherit them. Your cost basis is now $150,000 — not the original $5,000 she paid. If you sell them a week later for $150,000, you owe zero capital gains tax. All $145,000 of appreciation that occurred during her lifetime is never taxed.

According to IRS Publication 544, this applies to most inherited assets, with some exceptions for assets in retirement accounts and gifts received before death. Gifts while the person is alive do not get stepped-up basis — you inherit the donor’s original cost basis and owe tax on the full gain when you sell.

This is a major estate planning consideration. High-net-worth families often structure portfolios to hold appreciated assets until death specifically to pass on the step-up. For a typical investor, it means: if you’ve inherited stock, find out the fair market value on the date of death, because that’s your new basis. Your brokerage won’t always have this information — you may need the estate executor’s records or a historical price lookup.

How you actually report and file capital gains

You’ll receive a Form 1099-B from your brokerage by mid-February showing every sale you made during the year: the security name, date acquired, date sold, proceeds, cost basis, and whether the gain or loss is short-term or long-term. If you sold 30 positions, you get 30 lines.

Those transactions go onto Form 8949, where you report each sale individually and note any adjustments (wash sales, non-deductible losses, inherited basis adjustments). Form 8949 feeds into Schedule D, which calculates your net capital gain or loss and determines your final tax.

Here’s the part that trips people up: if your brokerage reports a cost basis to the IRS that doesn’t match what you report on your 8949, the IRS computers flag it. This happens most often when you transferred shares from another brokerage and the new broker doesn’t have your original purchase records, or when you inherited shares and the brokerage uses the wrong basis. You won’t get audited immediately, but you’ll get a letter asking you to reconcile the mismatch — and if you can’t document your basis, the IRS will assume it’s zero and tax the entire proceeds as gain.

I recommend downloading your 1099-B the day it’s available and checking that every line matches your own records. If something looks wrong — especially a missing or incorrect cost basis — contact your brokerage before you file. Fixing it afterward takes months.

If you’ve made large gains during the year and expect to owe more than $1,000 in tax, you may need to make estimated quarterly payments to avoid an underpayment penalty. (See estimating quarterly taxes if you’re self-employed or sold a large position.)

What it means for you in practice

Holding an extra few months to cross the one-year threshold can cut your tax rate in half or more. If you’re sitting on both gains and losses, consider whether selling the loser before year-end makes sense to offset the winner — just watch the wash-sale window.

Your state’s rules matter. Look them up or ask your tax preparer.

If you’re trading frequently in a taxable account (not a 401k or IRA), you’re likely racking up short-term gains and paying the highest possible rates. Inside retirement accounts, capital gains aren’t taxed at all — they grow tax-deferred.

If you inherit appreciated securities, find out the fair market value on the date of death before you sell. That’s your new basis, and it could save you tens or hundreds of thousands in tax.

If your 1099-B shows a blank or incorrect cost basis, fix it with your brokerage before you file. An IRS letter six months later is much harder to resolve.

Disclaimer

This is not financial advice. Tax laws vary by state, income level, filing status, and personal circumstance. I’m explaining how the system works, not telling you what to do with your money. If you’re facing a large gain or thinking about tax strategies, talk to a CPA or tax professional who knows your situation.

For context on how this plays out with cryptocurrency (where high turnover often means short-term gains), see crypto capital gains tax. If you’re comparing brokerages and want to know which platforms make tax reporting easier, brokerage comparison 2025 has a breakdown of tax document quality and loss-harvesting tools.

FAQ

How much do I owe in capital gains taxes?

It depends on how long you held the investment and your total taxable income. Long-term gains (held over one year) are taxed at 0%, 15%, or 20% federally depending on your income bracket. Short-term gains (held one year or less) are taxed at your ordinary income rate, which could be as high as 37%. Add state taxes on top.

Do I have to pay taxes on investment gains?

Yes, with very narrow exceptions. If you sell an investment for a profit in a taxable brokerage account, you owe tax on the gain. Gains inside 401(k)s and IRAs grow tax-deferred, so you don’t owe anything until you withdraw. The only common exception: selling your primary residence for a gain under $250,000 (single) or $500,000 (married) after living there at least two of the last five years.

What if I sell at a loss?

Capital losses offset capital gains. If your losses exceed your gains, you can deduct up to $3,000 of the excess against ordinary income each year. Any remaining loss carries forward to future tax years. Just watch out for the wash-sale rule if you buy back the same investment within 30 days before or after the sale.

What happens to capital gains on inherited assets?

Inherited assets receive stepped-up basis — your cost basis resets to the asset’s fair market value on the date of death. This eliminates all prior capital gains tax-free. If you sell shortly after inheriting, you may owe little or no tax, even if the asset appreciated significantly during the previous owner’s lifetime.

How can I reduce capital gains taxes?

The most straightforward approach is holding investments longer than one year to qualify for lower long-term rates. Beyond that, strategies like tax-loss harvesting (selling losers to offset winners), donating appreciated stock to charity, or timing sales across tax years can help — but these are questions for a tax professional, not something to wing on your own.


I still hold that position I mentioned earlier — the one that’s up 40%. Every year I think about selling, and every year I realize I’d owe 15% federal, 3% state, and I’m not ready to part with that chunk. Maybe I’ll hold it long enough to pass it on with stepped-up basis. Or maybe I’ll sell when the tax math makes more sense. That’s the trade-off: the IRS gives you lower rates for patience, and sometimes patience wins.