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

Investment Sale Details

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

89Score
StrongRetirement readiness

Tax Efficiency Score

Excellent! Your effective capital gains rate is only 11.49%. You're keeping most of your gains.

Total Tax on Gain

$2,298

Net After Tax

$47,702

RiskReviewStrong

Capital Gain

$20,000

long-term gain

Federal Tax

$1,298

15.00% marginal rate

NIIT (3.8%)

$0

below threshold

Effective Tax Rate

11.49%

all-in on the gain

Proceeds Breakdown

How your investment sale is divided

Total

$80,000

Net Proceeds

60%

$47,702/yr

Federal Cap Gains Tax

2%

$1,298/yr

State Tax

1%

$1,000/yr

Cost Basis (returned)

38%

$30,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,3500%$11,350$0
$48,350 - $533,40015%$8,650$1,298

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,298$0$1,000$2,29811.49%
5$4,000$0$0$1,000$1,0005.00%

0% Capital Gains Bracket Room

How much gain you can realize at 0% federal tax

Room in 0% Bracket

$11,350

of gain taxed at 0% federal rate

Room in 15% Bracket

$496,400

total room before hitting 20% rate

Personalized Insights

Actionable recommendations based on your numbers

7 insights
Note#1

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

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

Note#2

$11,350 of room in the 0% bracket

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

Positive#3

No NIIT surtax applies

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

Positive#4

No additional Social Security taxation

The capital gain doesn't push more of your Social Security benefits into taxable territory. Your provisional income stays in the same SS taxation band.

Positive#5

Save $1,298 by spreading gains over 2 years

Selling in one year costs $2,298 in total tax. Spreading the gain evenly over 2 years reduces total tax to $1,000, a savings of $1,298.

Note#6

State tax adds $1,000 to the bill

Your 5% state capital gains rate contributes $1,000. States like Florida, Texas, Nevada, and Washington have no state capital gains tax.

Note#7

Consider tax-loss harvesting

If you have investments with unrealized losses, selling them in the same year can offset up to $20,000 of this gain. Any excess losses can offset up to $3,000 of ordinary income, with the remainder carried forward.

Calculator guide

Capital Gains Tax in Retirement: How to Maximize Your 0% Bracket

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

Overview

Selling investments from a taxable brokerage account is a common way to fund retirement, but it can trigger a significant tax bill. For retirees, managing capital gains tax is a delicate balancing act. The goal is to access your money without pushing yourself into a higher tax bracket or triggering other stealth taxes. Unlike your working years, your income in retirement can be lumpy, making it the perfect time to strategically realize gains.

This calculator helps you estimate the federal and state tax on an investment sale, but its real power is showing you how much room you have in the 2026 0% long-term capital gains bracket—which for married couples extends up to $96,700 of taxable income. By understanding these thresholds, you can plan sales to minimize or even eliminate your tax liability, a key part of any tax-efficient retirement withdrawal strategy.


1

2026 Long-Term Capital Gains Tax Brackets for Retirees

For assets held longer than one year, long-term capital gains are taxed at preferential rates of 0%, 15%, or 20%. These rates are determined by your total taxable income, which includes not just the capital gain itself but also income from pensions, part-time work, and the taxable portion of your Social Security benefits.

Your capital gains are "stacked" on top of your ordinary income to determine which bracket they fall into.

Filing Status0% Rate Taxable Income15% Rate Taxable Income20% Rate Taxable Income
SingleUp to $48,350$48,351 – $533,400Over $533,400
Married Filing JointlyUp to $96,700$96,701 – $600,050Over $600,050
Head of HouseholdUp to $64,750$64,751 – $566,700Over $566,700

Key Considerations:

  • Short-Term Gains: Assets held for one year or less are taxed as ordinary income, at rates up to 37%, so it's almost always better for retirees to hold assets for over a year before selling.
  • Net Investment Income Tax (NIIT): A 3.8% surtax applies to the lesser of your net investment income or the amount your Modified Adjusted Gross Income (MAGI) exceeds certain thresholds ($200,000 for Single, $250,000 for Married Filing Jointly). This tax is in addition to the capital gains tax.
  • State Taxes: Many states also tax capital gains as regular income. This calculator helps you factor in state taxes, which can significantly impact your net proceeds.

2

Strategic Gain Harvesting: Filling Your Low-Tax Brackets

One of the most powerful tax strategies in retirement is "tax-gain harvesting." This involves intentionally selling appreciated assets to realize long-term capital gains up to the top of the 0% or 15% tax bracket. This is especially valuable in low-income years, such as the period after you stop working but before you start taking Required Minimum Distributions (RMDs) or Social Security.

Here’s how it works:

  1. Calculate Your Ordinary Income: Add up your expected income from pensions, part-time work, interest, and the taxable portion of Social Security.
  2. Determine Your Bracket Room: Subtract your ordinary taxable income from the top of the 0% capital gains bracket ($96,700 for MFJ in 2026). The result is how much you can realize in long-term gains without paying any federal tax.
  3. Realize Gains: Sell enough of your appreciated assets to generate a gain that "fills up" that room.
  4. Reinvest (Optional): You can immediately buy back the same security if you wish. Unlike tax-loss harvesting, there is no "wash sale" rule for gains. This action resets your cost basis to the new, higher value, reducing the future capital gain when you sell it again years later.

This strategy is a core component of a flexible retirement withdrawal strategy. By realizing gains in low-income years, you reduce the concentration of highly appreciated shares in your portfolio. This prevents a future scenario where a single large sale (e.g., for a new car or a home repair) pushes you into the 20% bracket and triggers the NIIT. It smooths out your tax liability over your lifetime, potentially saving you tens of thousands of dollars. A tax-efficient retirement withdrawal calculator can help model the long-term impact.


3

The Hidden Tax: How Gains Can Make Social Security Taxable

A large capital gain can create a "tax torpedo" by increasing your "provisional income," the figure the IRS uses to determine if your Social Security benefits are taxable. This can cause a double-whammy: you pay tax on the gain itself, and you pay additional income tax because more of your Social Security benefits are now included in your taxable income.

Provisional income is calculated as: Adjusted Gross Income (AGI) + Nontaxable Interest + 50% of Your Social Security Benefits

The thresholds are:

  • Married Filing Jointly:
    • Below $32,000: 0% of benefits are taxable.
    • $32,000 - $44,000: Up to 50% of benefits are taxable.
    • Above $44,000: Up to 85% of benefits are taxable.
  • Single / Head of Household:
    • Below $25,000: 0% of benefits are taxable.
    • $25,000 - $34,000: Up to 50% of benefits are taxable.
    • Above $34,000: Up to 85% of benefits are taxable.

Because capital gains are included in AGI, a $50,000 gain can easily push your provisional income over the 85% threshold. This means that for every dollar of capital gain realized, you could be adding another $0.85 of Social Security income to your tax return, which is then taxed at your ordinary income rate. This hidden interaction can make the true tax rate on your capital gain much higher than the stated 0% or 15%. Use a provisional income calculator to see exactly where you stand before making a large sale.


4

Scenario: Planning a $50,000 Stock Sale in Retirement

Let's consider a married couple, both age 68. In 2026, their retirement income consists of:

  • $40,000 from the husband's pension.
  • $35,000 in total Social Security benefits.
  • They plan to take the standard deduction of $30,000, plus the additional amount for being over 65 ($1,550 x 2 = $3,100), for a total deduction of $33,100.

They want to sell a stock they bought years ago. The sale proceeds would be $50,000, and their cost basis is $10,000, resulting in a $40,000 long-term capital gain.

Analysis without the Gain:

  1. Provisional Income: $40,000 (pension) + 50% of $35,000 (SS) = $57,500.
  2. Taxable Social Security: Since $57,500 is above the $44,000 threshold, 85% of their benefits are taxable: 0.85 * $35,000 = $29,750.
  3. Taxable Income: $40,000 (pension) + $29,750 (taxable SS) - $33,100 (deduction) = $36,650.

This taxable income of $36,650 is well within the 0% LTCG bracket, which goes up to $96,700 for MFJ.

Analysis with the $40,000 Gain:

  1. New AGI: $40,000 (pension) + $29,750 (taxable SS) + $40,000 (gain) = $109,750.
  2. Total Taxable Income: $109,750 - $33,100 (deduction) = $76,650.
  3. Capital Gains Tax: The entire taxable income of $76,650 is below the $96,700 threshold for the 0% LTCG bracket.

Result: The couple can realize the entire $40,000 long-term capital gain and pay $0 in federal capital gains tax. They have successfully used their 0% bracket room. This is a far better outcome than if they waited until RMDs from a large 401(k) pushed their ordinary income much higher.


5

The Math Behind Your Capital Gains Tax Bill

The calculator determines your tax liability by layering your capital gain on top of your other income sources. Here are the core formulas it applies.

First, it calculates your actual capital gain:

Capital Gain = Sale Proceeds - Cost Basis

Next, it determines your taxable ordinary income, which sets the foundation for where your capital gains will be taxed. This includes the complex calculation for taxable Social Security.

Taxable Ordinary Income = (Ordinary Income + Taxable Social Security) - Standard or Itemized Deduction

Where:

  • Sale Proceeds = The total amount you receive from selling the investment.
  • Cost Basis = Your original purchase price, including reinvested dividends.
  • Ordinary Income = Income from pensions, work, interest, RMDs, etc.
  • Taxable Social Security = The portion of your benefits subject to tax, based on your provisional income.
  • Deduction = Your standard or itemized deduction for the year.

The main calculation then determines the federal tax by allocating the gain across the long-term capital gains brackets.

Federal Capital Gains Tax = (Gain in 0% Bracket * 0.00) + (Gain in 15% Bracket * 0.15) + (Gain in 20% Bracket * 0.20)

Where:

  • Gain in 0% Bracket = The portion of your capital gain that fits under the 0% bracket ceiling after accounting for your ordinary taxable income.
  • Gain in 15% Bracket = The portion of your gain that falls into the 15% bracket.
  • Gain in 20% Bracket = The portion of your gain that falls into the 20% bracket.

Finally, the Net Investment Income Tax (NIIT) is calculated if your income exceeds the threshold.

NIIT = 3.8% * Lesser of (Net Investment Income) or (MAGI - NIIT Threshold)

Where:

  • Net Investment Income = Includes capital gains, dividends, interest, etc.
  • MAGI = Modified Adjusted Gross Income.
  • NIIT Threshold = $200,000 for Single filers, $250,000 for Married Filing Jointly.

6

Answers to Your Capital Gains Questions in Retirement

How are qualified dividends taxed in retirement?

Qualified dividends are taxed at the same preferential 0%, 15%, and 20% rates as long-term capital gains. They also use up room in those brackets, so a year with high dividend income leaves less space for realizing capital gains at the 0% rate. This calculator allows you to input qualified dividends for a more accurate estimate.

Can I use capital losses to offset gains?

Yes. This is called tax-loss harvesting. You can offset capital gains with capital losses from other investments. If your losses exceed your gains, you can deduct up to $3,000 of the excess against your ordinary income per year. Any remaining losses can be carried forward to future years.

Is my primary home sale subject to capital gains tax?

For most retirees, no. If you've owned and lived in your home for at least two of the five years before the sale, you can exclude up to $250,000 of gain if you're a single filer, or up to $500,000 if you're married filing jointly.

What is a "step-up in basis"?

When you inherit an asset, like stock or real estate, its cost basis is "stepped up" to its fair market value on the date of the original owner's death. This means your heir could sell the asset immediately and owe little to no capital gains tax. This is a powerful estate planning tool, though it is subject to changes in tax law like the potential sunset of the current estate tax exemption.

How do Roth conversions affect my capital gains tax?

A Roth conversion creates ordinary income, which fills up your standard deduction and lower tax brackets first. This directly reduces the amount of room available in the 0% and 15% capital gains brackets. It's crucial to coordinate Roth conversions and capital gain harvesting in the same year to avoid an unexpected tax bill.

Does selling investments in an IRA or 401(k) create a capital gain?

No. Capital gains taxes only apply to non-retirement (taxable) brokerage accounts. All withdrawals from a traditional IRA or 401(k) are taxed as ordinary income, regardless of the gains inside the account. Qualified withdrawals from a Roth IRA are completely tax-free.

What's the difference between marginal and effective tax rate on a gain?

Your marginal rate is the tax rate paid on the last dollar of your capital gain (e.g., 15% or 20%). Your effective tax rate is the total tax paid divided by the total gain. The effective rate is often lower because some of your gain may have been taxed at 0% before the rest was taxed at 15%.


7

Plan Your Next Move

Understanding your capital gains exposure is a critical piece of retirement income planning. Use this calculator to model different sale amounts and see how timing can impact your total tax bill.

For a broader view, see how this fits into your overall withdrawal plan with the Retirement Withdrawal Calculator or explore different sequences with the Retirement Withdrawal Strategy Calculator. To understand the long-term impact on your portfolio, use the How Long Will My Money Last Calculator.