Start my plan

Capital Gains Tax in Retirement Calculator

Estimate federal and state taxes on investment sales in retirement. Find your 0% capital gains bracket, see the impact on Social Security taxation, and explore optimal gain timing strategies.

Filing Status & Retirement Income

Annual gross income before the standard deduction, from pensions, RMDs, part-time work, and other non-capital-gains sources (excluding Social Security, which is entered separately).

Investment Sale Details

The total amount you expect to receive from selling the investment.

Your original purchase price plus any reinvested dividends or adjustments. The gain is sale proceeds minus cost basis.

Long-term gains get preferential 0%/15%/20% rates. Short-term gains are taxed as ordinary income.

Your state's tax rate on capital gains (0-20%). Some states (FL, TX, NV, WA, etc.) have 0%.

Your results

12.46% effective rate on your long-term gain

You will pay $2,492 in total taxes on a $20,000 long-term capital gain, keeping $47,508 of your $50,000 sale proceeds.

Capital Gain
$20,000
long-term
Total Tax
$2,492
12.46% effective
Federal Tax
$1,114
15.00% marginal
NIIT (3.8%)
$0
below threshold

Based on 2026 federal tax brackets. Long-term gains use preferential 0%/15%/20% rates. State tax at 5%.

12.46% effective rate on your long-term gain

See if a bad market changes that

Gain Breakdown

How your capital gain is divided between taxes and net proceeds

Total

$20,000

/yr

Net Proceeds
88%
$17,508/yr
Federal Cap Gains Tax
6%
$1,114/yr
SS Tax Torpedo
2%
$378/yr
State Tax
5%
$1,000/yr

Long-Term Capital Gains Bracket Breakdown

How your gain flows through each tax bracket

Gain Timing Optimization

Total tax if you spread the same gain over multiple years

Bracket Detail

Capital gains tax by LTCG bracket

Tax BracketRateGain in BracketTax Owed
$0 - $48,4750%$12,575$0
$48,475 - $533,40015%$7,425$1,114

Year-by-Year Spread Analysis

Tax savings from spreading the gain over multiple tax years

YearsGain / YearFederal TaxNIITState TaxTotal TaxEff. Rate
1$20,000$1,492$0$1,000$2,49212.46%
5$4,000$1,890$0$1,000$2,89014.45%

Showing 2 of 5 rows

0% Capital Gains Bracket Room

How much gain you can realize at 0% federal tax

Room in 0% Bracket

$12,575

of gain taxed at 0% federal rate

Room in 15% Bracket

$497,500

total room before hitting 20% rate

Personalized Insights

Actionable recommendations based on your numbers

  • info:

    Effective tax rate: 12.46% on $20,000 gain

    You'll pay $2,492 in total taxes (federal LTCG, NIIT, and state) on the $20,000 capital gain, keeping $47,508 of your $50,000 sale proceeds.

  • info:

    $12,575 of room in the 0% bracket

    You can realize up to $12,575 in long-term gains at 0% federal tax. Consider selling only that amount this year and deferring the rest to future years.

  • success:

    No NIIT surtax applies

    Your modified AGI stays below the $200,000 NIIT threshold. No 3.8% surtax on your investment income.

Showing 3 of 7 insights

See what your numbers mean together.

Turn this result into a retirement plan you can test, adjust, and return to as life changes.

Build my retirement plan
Calculator guide

Capital Gains Tax in Retirement Calculator: Estimate Tax on Investment Sales

Use this guide to understand the assumptions, inputs, results, and next steps behind the calculator.

Created by Luis Gonzalez · Last updated July 1, 2026

Overview

Capital gains tax is tax on the profit from selling an asset, not usually on the full sale proceeds. In retirement, the tax result can depend on how long you held the investment, your other taxable income, filing status, Social Security benefits, qualified dividends, and state taxes. This calculator estimates federal capital-gains tax, the net investment income tax (NIIT), state tax, and the effect of spreading a gain across multiple years.

At the default inputs, $50,000 of sale proceeds minus a $30,000 cost basis produces a $20,000 capital gain. The calculator treats it as a long-term gain, estimates $0 federal capital-gains tax, $0 NIIT, and $1,000 state tax using the 5% state-rate input. Some precomputed federal totals and effective-rate values are unavailable, so this article does not infer a total tax or net proceeds from them.

For related tax estimates, compare RMD tax, IRA withdrawal tax, or pension withdrawal tax.

1

Enter sale proceeds, basis, and income

Enter the expected amount received from selling the investment and its cost basis. Cost basis is generally the amount invested, adjusted for relevant transactions such as reinvested distributions, splits, and certain fees. The difference between proceeds and basis is the gain used in the estimate. If basis exceeds proceeds, the calculator floors the capital gain at zero; it does not estimate a deductible capital loss.

Choose long-term or short-term holding period. In general, an asset held for more than one year may qualify for long-term capital-gains rates; short-term gains are generally taxed using ordinary income tax rates. Review the IRS explanation of capital gains and losses because asset type and transaction details can affect treatment.

Add ordinary income, Social Security income, qualified dividends, filing status, and the state tax rate. The calculator uses the standard-deduction input and its internal federal tax brackets. The default state rate is 5%; actual state rules may use different rates, deductions, or treatment. For a more complete retirement income picture, compare 401(k) withdrawal taxes and tax-efficient retirement withdrawals.

2

Default example: calculate the gain before the tax

The default sale proceeds are $50,000, and cost basis is $30,000:

Capital gain = sale proceeds − cost basis

$50,000 − $30,000 = $20,000.

Because the holding-period input is long-term, the calculator puts the gain into its preferential-rate calculation. With the other defaults—single filing status, $35,000 ordinary income, $20,000 Social Security income, no qualified dividends, and a 5% state rate—the precomputed results show:

ResultDefault estimate
Capital gain$20,000
Total AGI shown by the calculator$72,000
Federal capital-gains tax$0
NIIT$0
State tax$1,000
Taxable Social Security share85%
Additional taxable Social Security amount shown$3,150

The $1,000 state estimate follows $20,000 × 5% = $1,000. The federal capital-gains tax and NIIT are each shown as $0 in the precomputed result. The calculator’s total tax, net proceeds, effective tax rate, taxable ordinary income, and bracket-room outputs are unavailable in the supplied results; do not treat the displayed components as a complete tax bill.

The “85%” Social Security result refers to the taxable share used in the calculation, not an 85% tax rate. Likewise, the displayed $3,150 is the increase in taxable Social Security amount calculated when the gain is included; it is not $3,150 of tax. The IRS explains how Social Security benefits may be taxable.

3

What changes the tax estimate

Holding period changes the federal rate method. The calculator uses ordinary tax brackets for short-term gains and preferential long-term brackets for long-term gains. A sale classified as short-term can therefore produce a different federal estimate even when the gain amount stays the same.

Other income can use up lower-rate bracket space. Long-term capital gains stack above taxable ordinary income in the model. More ordinary income can leave less room for gains in a lower capital-gains bracket. Retirement distributions, wages, pensions, and taxable interest can all matter. For account withdrawals, see how 401(k) withdrawals are taxed in retirement.

Social Security can be affected without the gain being wages. The calculator compares taxable Social Security before and after including the capital gain. This means a gain may increase the taxable portion of benefits, even though Social Security is not itself a capital gain. The taxable portion is not the same as the tax owed; it is included in income calculations.

NIIT is a separate tax. The calculator checks modified adjusted gross income against an NIIT threshold and applies its logic to net investment income. For 2026 planning, verify current rules and thresholds with the IRS Net Investment Income Tax guidance. Tax thresholds can change, and individual rules may differ from a simple estimate.

State tax is a simplified rate input. The default 5% is applied to the capital gain in the calculator’s estimate. It does not account for state-specific deductions, exemptions, or differing definitions of taxable income. The IRS tax withholding estimator can help with federal withholding planning, but it is not a state tax calculator.

4

Formula and bracket logic

These formulas describe the calculator’s main steps. Bracket thresholds are determined by its internal tables, filing status, and standard-deduction input; verify current-year tax rules before making a sale.

Capital gain = max(0, sale proceeds − cost basis)

Default: max(0, $50,000 − $30,000) = $20,000.

Long-term taxable gains = capital gain + qualified dividends

Default: $20,000 + $0 = $20,000. For short-term gains, the model instead adds the gain to taxable ordinary income and estimates the additional ordinary tax.

Estimated state tax = capital gain × entered state tax rate

Default: $20,000 × 5% = $1,000.

Taxable ordinary income = max(0, ordinary income + taxable Social Security − standard deduction)

The Social Security amount in this calculation can change when a gain is included. The standard deduction is provided as an input and should match the relevant tax year and filing status. The calculator’s federal estimate does not capture every tax-law exception, asset-specific basis rule, or personal deduction.

5

Compare timing and tax tradeoffs

The calculator includes a year-spread table that divides the gain across multiple years. The default display spreads the $20,000 gain across five years, or $20,000 ÷ 5 = $4,000 per year. The precomputed final row shows a $4,000 annual gain, with $0 NIIT and $1,000 state tax in that row. Federal tax and total-tax fields for the spread rows are unavailable in the supplied output, so compare these scenarios in the calculator rather than assuming that the split produces a particular total tax.

Strategy to testGain per yearYearsWhat to check
Sell in one year$20,0001Whether income fills a higher bracket or affects Social Security taxation
Spread across two years$10,0002Whether splitting changes federal bracket use or NIIT exposure
Spread across five years$4,0005Whether lower annual gains are worth delaying the sale
Sell after a lower-income yearVaries1 or moreWhether timing changes taxable income and available bracket space

These are arithmetic scenarios, not guaranteed tax outcomes. Spreading a sale may reduce tax in some circumstances, but it can also expose you to market risk, delay access to proceeds, or create additional transactions. Check whether the investment can be sold in pieces and whether tax lots have different bases. You can also compare a qualified dividend tax estimate or pension tax by state.

6

Questions about capital-gains tax in retirement

Is capital-gains tax charged on the full sale price?

Usually, the taxable gain is based on proceeds minus adjusted cost basis—not the entire sale price. The exact basis calculation can depend on the asset and its transaction history.

Why can a capital gain affect Social Security taxes?

A gain can raise the income measure used to determine how much of your Social Security benefits is taxable. That does not mean the gain itself is a Social Security tax; it can increase taxable benefits as part of the income calculation.

Does a $0 federal estimate mean I owe no tax on the sale?

No. The result can still include state tax, and the estimate may not include every applicable tax or special rule. The default result includes $1,000 of state tax and does not provide a complete total-tax value in the supplied precomputed data.

Should I sell all at once or spread the gain over several years?

It depends on bracket space, other income, the NIIT, state rules, investment risk, and whether you need the proceeds. Compare one-year and multi-year scenarios, then weigh possible tax savings against the risk of holding the asset longer.

Are short-term gains taxed at the same rate as long-term gains?

Not in the calculator. It estimates short-term gains using ordinary income tax brackets and long-term gains using preferential capital-gains brackets. Holding period and asset-specific rules should be verified before selling.

7

Check the estimate before a sale

Confirm the cost basis, holding period, filing status, standard deduction, and expected income for the year of sale. Then test different sale amounts and dates, and compare the tax estimate with other income decisions using the estimated tax payment calculator for retirees and tax-efficient withdrawal guidance. Use official IRS and state guidance for current-year rules.

KEEP EXPLORING

Explore another question connected to this topic.

Browse all calculators