Skip to content

Written and reviewed by FinanceCruncher Editorial Team

Last reviewed 2026-07-05. Sources and assumptions are documented below.

Editorial policyCalculator methodologyCorrections policy

How capital gains tax works

Selling an investment, rental property, or other asset for more than you paid triggers a capital gain — and often a tax bill. How much you owe depends on how long you held the asset, your income, and whether gains are short-term or long-term. This guide explains the holding period rule, 2025 rate brackets, worked examples, and common strategies to reduce tax.

Capital gains tax sits on top of your ordinary income picture but uses its own rate schedule for long-term gains. Losses, wash sales, qualified dividends, state taxes, and surtaxes like NIIT all interact on your return. Understanding those interactions helps you time sales, harvest losses deliberately, and estimate what you will actually owe — not just what the headline federal rate suggests.

What is a capital gain?

A capital gain is profit from selling an asset for more than your cost basis — what you paid, plus commissions and (for real estate) certain improvements.[1] Taxable gain equals sale price minus adjusted basis. If you sell for less than basis, you have a capital loss, which may offset other gains.

Basis includes purchase price, reinvested dividends in some cases, and capital improvements on property. It is reduced by depreciation taken on rental real estate, which can increase taxable gain when you sell. Assets held in tax-advantaged accounts (401(k), IRA, Roth IRA) generally do not trigger capital gains tax on trades inside the account; taxation happens on withdrawal (traditional) or not at all on qualified Roth distributions.

Not every profitable sale is a capital gain for tax purposes. Inventory sold by a business, ordinary income from dealer activity, and some collectibles follow different rules. For typical stock, bond, ETF, mutual fund, and real property investors, Schedule D and Form 8949 are where gains and losses are reported.[2]

Short-term vs. long-term rates — and qualified dividends

Short-term (held one year or less): taxed as ordinary income at the same rates as wages — 10% through 37% in 2025.[1]

Long-term (held more than one year): taxed at preferential rates of 0%, 15%, or 20% depending on taxable income.[2]

Qualified dividends from U.S. corporations and qualifying foreign stocks use the same 0%, 15%, and 20% brackets as long-term capital gains — they stack together when determining which rate applies.[3] Nonqualified (ordinary) dividends are taxed at ordinary rates like short-term gains. Before selling appreciated shares for income, compare taking qualified dividends against realizing gains; both may face the preferential rate but only sales change your position.

2025 long-term capital gains brackets (taxable income)

2025 federal long-term capital gains tax rate thresholds by filing status
RateSingleMarried filing jointly
0%Up to $48,350Up to $96,700
15%$48,351 – $533,400$96,701 – $600,050
20%Over $533,400Over $600,050

Thresholds are for 2025 and apply to net long-term capital gains plus qualified dividends. State taxes may apply separately.

The 1-year holding period rule

Sell on day 365 or earlier and gains are short-term. Wait until day 366 and the same gain may qualify for long-term rates — often a significant difference near the one-year mark.[1] For large positions, a few weeks of patience can save thousands.

The holding period clock starts the day after you acquire the asset and includes the day you sell. Partial shares and reinvested dividends each have their own lot and holding period if you track specific identification. Default FIFO (first in, first out) selling may trigger short-term gains even if you intended to sell older, long-term lots — specify lots when placing trades if your broker allows it.

Inherited assets generally receive long-term treatment regardless of how long you held them after inheritance, but the basis step-up rules apply separately.[1]Gifted assets may carry over the donor’s holding period and basis, which can complicate the long-term vs. short-term calculation for the recipient.

Netting capital gains and losses

Capital losses offset capital gains in a defined order on your tax return.[2] Short-term losses first offset short-term gains; long-term losses offset long-term gains. If one category has net losses and the other net gains, the excess crosses over — net short-term loss can offset net long-term gain, and vice versa.

After netting within the year, if losses still exceed gains, you may deduct up to $3,000 of net capital loss against ordinary income ($1,500 if married filing separately).[1]Additional losses carry forward indefinitely to future years until used. That carryforward preserves tax value from down years — track it on your prior return’s Schedule D.

Tax-loss harvesting — selling losing positions to realize losses — is deliberate use of this netting system.[3] Harvest before year-end if you have gains to offset, but watch wash sale rules (next section) if you plan to repurchase the same security. Losses in tax-advantaged accounts do not count; only taxable brokerage sales generate deductible capital losses.

Wash sale rules

A wash sale occurs when you sell a security at a loss and buy the same or a substantially identical security within 30 days before or after the sale.[5] The loss is disallowed for current-year tax purposes — you cannot use it to offset gains that year. Instead, the disallowed loss is added to the basis of the replacement shares, deferring the tax benefit until you eventually sell those shares for good.

Wash sales apply across all your accounts, including IRAs: buying the same stock in an IRA within the window after selling it at a loss in a taxable account can permanently disallow the loss (you cannot increase IRA basis the same way). Automated dividend reinvestment counts as a purchase — a small reinvestment can trigger a wash sale if you sold the fund at a loss recently.

To harvest losses without triggering a wash sale, wait 31 days to repurchase, buy a similar but not substantially identical fund (S&P 500 index fund vs. total market fund, for example), or double up first and sell the original lot after 31 days. Tax software and broker 1099-B forms flag many wash sales, but tracking lot-level trades yourself avoids surprises at filing time.

NIIT and state capital gains taxes

Higher earners may owe an additional 3.8% NIIT on investment income when modified adjusted gross income exceeds $200,000 (single) or $250,000 (MFJ).[4] That can bring the effective top long-term rate to 23.8%. NIIT applies to net investment income — interest, dividends, capital gains, rental income, and passive business income — not wages. If MAGI is below the threshold, NIIT is zero regardless of how large your capital gain is.

Federal long-term rates are only part of the bill. Most states tax capital gains as ordinary income; a few offer preferential treatment or no income tax at all. California taxes capital gains at the same rates as wages — up to 13.3% for high earners — with no long-term discount. Florida, Texas, and several other states have no personal income tax, so only federal rules apply to gains on securities.

State tax is often overlooked when comparing a 15% federal long-term rate to a 22% short-term ordinary rate — adding 5–9% state tax on top can narrow the gap. If you are planning a large sale (business, rental property, concentrated stock), estimate combined federal, state, and NIIT liability. Use the income tax estimator alongside the capital gains tax calculator for a fuller picture. Multi-state residents may owe tax in more than one jurisdiction depending on where property sits and where they reside on the sale date.

How to calculate your gain — worked example

You bought 100 shares at $40 ($4,000 cost basis) and sold at $75 ($7,500). Capital gain = $3,500.

  • Held < 1 year, 22% ordinary bracket: federal tax ≈ $770
  • Held > 1 year, 15% long-term bracket: federal tax ≈ $525

Add state tax and NIIT if applicable. A $3,500 long-term gain in the 15% bracket saves $245 federal vs. 22% ordinary — before state. If you also had $2,000 in short-term losses from tax-loss harvesting, net gain drops to $1,500 and tax falls proportionally.[2]

Use the capital gains tax calculator to estimate federal and state tax on your sale price and basis.

Strategies to reduce capital gains tax

  1. Hold assets longer than one year when possible
  2. Tax-loss harvesting — sell losing positions to offset gains[3]
  3. Use tax-advantaged accounts (Roth IRA, 401(k)) for high-growth investments
  4. Donate appreciated assets to charity and avoid recognizing the gain
  5. Step-up in basis at death — inherited assets generally reset basis to fair market value at date of death[1]

Timing matters: bunching charitable donations, spreading large sales across tax years to stay in lower brackets, and gifting appreciated shares to family in lower brackets (watch kiddie tax rules) are common approaches. Installment sales on property can defer recognition over years. Each strategy has limits — charitable deductions face AGI caps, and related-party sales have anti-abuse rules.[3]

Inside retirement accounts, rebalancing does not trigger capital gains tax. For taxable accounts, prefer holding tax-efficient assets (broad index ETFs, tax-managed funds) in taxable space and less tax-efficient assets (REITs, active trading, taxable bonds) in tax-deferred accounts when you have both — a practice called asset location.

Real estate and rental property capital gains

Primary home exclusion: up to $250,000 of gain ($500,000 MFJ) may be excluded if you owned and used the home as your primary residence for two of the five years before sale.[1] Investment property and second homes do not qualify for this exclusion.

Rental and investment property sales add complexity. Depreciation taken over the ownership period is recaptured at up to 25% federal, separate from long-term capital gains rates. Net proceeds must account for selling costs, original purchase price, improvements, and cumulative depreciation. A property that appreciated on paper may still produce a larger tax bill than expected because of recapture.[1]

Section 1031 like-kind exchanges can defer gain on investment property when you reinvest in qualifying replacement property, but rules tightened in recent years and personal residences do not qualify. Model rental cash flow, sale proceeds, and tax with the rental property calculator before listing. Pair it with the income tax estimator if the sale will push you into a higher bracket or trigger NIIT.

Use the calculator: Estimate tax on a specific sale with the capital gains tax calculator. Read how investment fees affect returns for the full picture on after-tax wealth.

Sources

  1. [1]Topic No. 409 Capital Gains and Losses. Internal Revenue Service.
  2. [2]Instructions for Schedule D (Form 1040). Internal Revenue Service.
  3. [3]Publication 550, Investment Income and Expenses. Internal Revenue Service.
  4. [4]Questions and Answers on the Net Investment Income Tax. Internal Revenue Service.
  5. [5]Publication 550 — Wash Sales. Internal Revenue Service.