Taxes

How Do Capital Gains Taxes Work?

Austin LannomAugust 25, 202611 min read
Share
Back to Blog

The first time someone sells an investment at a profit, the same question arrives: do I owe tax on this, and how much?

The answer depends on two things most people don't realize matter: how long you held it, and what kind of account it was in. Both can materially change how a sale is taxed.

Here's how capital gains actually work, why the one-year mark matters so much, and the situations where you owe nothing at all.

Quick answer: A capital gain is profit from selling a capital asset, such as stocks, funds, real estate, or other property, for more than your basis. You generally owe tax only when you sell — unrealized growth isn't taxed. Assets held one year or less produce short-term gains, taxed at ordinary income rates. Assets held more than one year produce long-term gains, taxed at preferential federal rates of 0%, 15%, or 20% depending on your taxable income and filing status. Some gains, such as collectibles or real estate depreciation recapture, can use different rates, and states may tax capital gains differently. Investments inside tax-advantaged retirement accounts generally don't generate capital gains tax as they grow. Losses can offset gains, and rate thresholds adjust annually — check current IRS guidance for the year you're filing.

When a capital-gains bill may be zero — or not yet due. These are different situations, not one tax-free category:

  • You haven't sold. Unrealized growth generally isn't taxed — though a fund in a taxable account can still distribute gains to you.
  • Your taxable income is low enough that long-term gains fall in the 0% rate.
  • The trades happened inside a retirement account, where buying and selling generally doesn't create capital gains tax — though withdrawals have their own rules.
  • It was your main home and you qualify for the exclusion.

The Two Starting Points: When You Sold and How Long You Held

Realized. A gain generally isn't taxable until you sell. If a fund you own doubles and you don't sell, there's typically no capital gains tax on that growth — it's an unrealized gain. Sell, and it becomes realized.

That single fact explains why long-term investors can go years without a capital gains bill despite substantial growth — though funds in taxable accounts can still distribute gains along the way.

Held. How long you owned it before selling determines which rate applies:

Holding periodTypeTaxed at
One year or lessShort-termYour ordinary income tax rate
More than one yearLong-term0%, 15%, or 20%, depending on taxable income

"More than one year" means more than twelve months — not simply selling sometime in the next calendar year. The IRS counts the holding period starting the day after you acquired the asset, through and including the day you sold it.

The gap between the two is often large. Short-term gains are taxed like wages — at your marginal rate. Long-term gains get preferential treatment.

Selling a few days early can move a gain from long-term to short-term. Nothing about the investment changes; only the tax treatment does. It's worth knowing your purchase date before you sell.


How the Long-Term Rates Work

Long-term capital gains use three federal rates: 0%, 15%, and 20%. Which one applies depends on your taxable income and filing status.

Two things about that structure surprise people:

There genuinely is a 0% bracket. Taxpayers with taxable income below a threshold may owe no federal tax on long-term gains. That's not a loophole — it's how the rate schedule is written, and it matters for lower-income years, early retirement, and people between jobs.

The rates work in layers, like ordinary brackets. Crossing a threshold doesn't retroactively tax all your gains at the higher rate — only the portion above it. Same mechanic as ordinary income brackets, and the same misunderstanding.

The dollar thresholds adjust every year for inflation, so any specific figure ages quickly — and published sources lag at different rates. IRS Topic 409 covers the rules, and the current year's dollar amounts appear in the IRS annual inflation-adjustment revenue procedure. Check both, and confirm the tax year you're looking at. What doesn't change is the structure: three rates, determined by taxable income and filing status.

Two additional items may apply and are worth knowing: a 3.8% net investment income tax may apply at higher incomes, and certain asset types use different maximums — collectibles can be taxed at a higher maximum federal rate, and real estate depreciation recapture can be taxed differently. Neither affects most ordinary investors, but both are worth a professional conversation if you're near them.


Basis: The Number That Determines Your Gain

Your basis is generally what you paid, adjusted for certain items. Your gain is what you got out of the sale minus that adjusted figure.

Capital gain = amount realized − adjusted basis

For a beginner, you can think of that as sale proceeds minus what you paid, adjusted for items like reinvested dividends, commissions, improvements, depreciation, or other basis adjustments.

Basis is where errors happen, and they cost real money:

  • Reinvested dividends increase your basis. If you've been automatically reinvesting, each reinvestment purchased shares at some price. Forgetting that means overstating your gain and overpaying tax. Brokerages usually track this, but it's worth verifying — especially for older holdings or transferred accounts.
  • Inherited assets often receive a basis adjustment, commonly to fair market value at the date of death, which can dramatically reduce or eliminate the taxable gain for heirs. This is one of the more consequential rules in the tax code for families.
  • Gifted assets often carry over the giver's basis for gain purposes, though loss-basis rules can be different if the asset's value has fallen. Giving appreciated stock to someone passes the built-in gain along with it.

If you sell part of a position, which shares you sell can matter, since different lots may have different basis. Brokerages have default methods and often let you specify. Worth understanding before a large sale.

One caution: brokerage cost-basis reporting is helpful, but it may be incomplete for older holdings, transferred assets, inherited assets, gifts, or noncovered securities. If the number looks wrong, it can be.


Losses Are Useful

Capital losses aren't only bad news — they offset gains.

The general order: losses first offset gains of the same type, then the other type. If losses exceed gains, up to $3,000 per year — or $1,500 if married filing separately — can generally offset ordinary income, with the rest carried forward to future years.

One limit worth knowing: losses on personal-use property, like a personal car or home, generally aren't deductible. The gain side can be taxable while the loss side isn't deductible.

Offsetting gains deliberately is the basis of tax-loss harvesting — realizing a loss to offset gains. Two cautions:

  • The wash sale rule can disallow a loss if you buy the same or a substantially identical security within 30 days before or after the sale. Buying back too quickly can negate the benefit. The rule generally applies to stocks and securities, not every asset.
  • Harvesting is a timing strategy, not free money. It often reduces your basis in the replacement holding, deferring rather than eliminating tax.

Worth doing thoughtfully, and worth professional input for anything substantial.


The Account It Happened In

For most ordinary investors this matters as much as the holding period, and it gets far less attention.

In a taxable brokerage account, selling at a gain is a taxable event, and funds may also distribute capital gains to you even in years you didn't sell anything.

In tax-advantaged retirement accounts — a 401(k), traditional IRA, or Roth IRA — buying and selling inside the account generally doesn't create capital gains tax, so growth compounds without annual capital gains drag. That doesn't mean every withdrawal is tax-free — withdrawal rules depend on the account type. Traditional withdrawals are generally taxed as ordinary income; qualified Roth withdrawals can be tax-free. We cover that split in 401(k) vs. Roth IRA.

The practical consequence: rebalancing inside a retirement account generally doesn't trigger capital gains tax; the same trades in a taxable account may. That's a real argument for keeping the more frequently traded parts of a portfolio in tax-advantaged space where possible.

It's also why the target-date fund caution matters — automatic internal rebalancing is elegant in a 401(k) and can create taxable distributions in a brokerage account.


A Special Case: Selling a Home

Home sales have their own rule, and it's generous enough that many sellers owe nothing.

If the home was your main home and you meet the ownership and use tests, you may be able to exclude a substantial amount of gain from income: up to $250,000 for single filers and up to $500,000 for many married couples filing jointly.

Those are two separate tests. During the five years ending on the date of sale, you generally must have owned the home for at least two years and lived in it as your main home for at least two years. The periods don't have to be continuous, and they don't have to be the same two years.

There's also a frequency limit: you generally cannot use the full exclusion if you used it for another home sale during the two-year period before this sale.

Conditions apply, and the rules around rental use, partial exclusions, and prior exclusions get detailed quickly. You may also still have reporting requirements, especially if you receive Form 1099-S. If you're selling a home with meaningful appreciation, this is worth confirming against current IRS guidance or with a professional — the amounts involved justify the time.


The Bottom Line

Capital gains tax comes down to a short list: you generally owe when you sell, not while you hold. Holding more than a year moves you from ordinary rates to preferential ones. Your basis determines the size of the gain, and losses can offset it. And inside a retirement account, most of this simply doesn't apply.

None of that means you should let taxes drive investment decisions — holding a position you'd otherwise sell purely to avoid tax is its own risk. But knowing the one-year line, tracking your basis, and understanding which account you're trading in prevents the avoidable version of the bill.

That's what clarity looks like.

A sale usually exists to fund something — a down payment, a gap, a goal. Canopy can help you view supported connected and manually entered accounts, debts, bills, goals, estimated cash flow, and supported investment balances in one place, so you can see what a sale is meant to fund before you make decisions elsewhere. Canopy does not calculate taxes, gains, losses, basis, holding periods, tax lots, wash sales, exclusions, or after-tax proceeds. Start with Canopy — free, no credit card needed.

Canopy is not a tax adviser, tax preparer, broker, or investment adviser. It does not prepare or file tax returns, classify assets, determine whether an account is taxable or tax-advantaged, calculate capital gains or losses, determine capital-gain rates or thresholds, track cost basis, tax lots, or holding periods, choose lots, identify capital-gain distributions or wash sales, calculate net investment income tax, determine home-sale exclusion eligibility, provide tax-loss-harvesting advice, execute trades, or provide tax, investment, or legal advice. Consult a qualified tax professional or IRS.gov for your situation.



Frequently Asked Questions

Profit from selling a capital asset — stocks, funds, real estate, or other property — for more than your adjusted basis. Your adjusted basis is generally what you paid, adjusted for items like reinvested dividends, commissions, improvements, or depreciation. You typically owe capital gains tax only when you sell; growth you haven't sold is an unrealized gain and generally isn't taxed.

Related Canopy tools

Put what you just read into practice — tools inside Canopy that match this topic.

See your real spending. Free to start, no credit card needed.
Try Canopy free
The Money Insight — one money idea, every Friday from Austin.
AL
Written by
Austin Lannom

Accountant (MBA, CGFM) and dad of three building Canopy in Sparta, Tennessee. Spent his career making sense of organizational finances — now building a tool that does the same for everyday families.