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
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.
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.
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:
| Result | Default 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 share | 85% |
| 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.
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.
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.
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 test | Gain per year | Years | What to check |
|---|---|---|---|
| Sell in one year | $20,000 | 1 | Whether income fills a higher bracket or affects Social Security taxation |
| Spread across two years | $10,000 | 2 | Whether splitting changes federal bracket use or NIIT exposure |
| Spread across five years | $4,000 | 5 | Whether lower annual gains are worth delaying the sale |
| Sell after a lower-income year | Varies | 1 or more | Whether 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.
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.
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.