Selling stock in retirement taxes come down to a lever most retirees control directly: the timing and size of the gains you realize each year, because long-term capital gains are taxed at 0%, 15%, or 20% based on your total taxable income and filing status (Source: IRS Topic No. 409, 2025). Which rate applies is not fixed by wealth; it is set every year by how much taxable income you stack under those gains.
In 2026, a long-term stock gain can be taxed at 0% while total taxable income stays at or below $98,900 for married couples filing jointly or $49,450 for single filers, then 15% up to $613,700 (MFJ) or $545,500 (single), and 20% above those figures (Source: IRS Rev. Proc. 2025-32, 2025). Ordinary income fills those brackets first, so the 0% room is often smaller than it looks.
How is selling stock taxed in retirement?
Selling stock held longer than one year produces a long-term capital gain taxed at 0%, 15%, or 20% depending on your 2026 taxable income and filing status (Source: IRS Topic No. 409, 2025; IRS Rev. Proc. 2025-32, 2025). Shares held one year or less produce a short-term gain taxed at ordinary income rates. Retirement does not change these rules; your income mix does.
Talk With Craig Wear's Team
Craig has helped IRA millionaires save over $1 million each in unnecessary taxes. Find out if a Roth conversion strategy fits your retirement, with no sales pressure and no product pitch.
The rate is tied to a taxable-income ceiling, not to the size of the gain by itself. Two retirees can sell the same $40,000 gain and pay very different tax because one sits inside the 0% band and the other has pushed past it with other income.
The 2026 breakpoints below come from Rev. Proc. 2025-32, Section 4.03, which sets the top of the 0% band (“Maximum Zero Rate Amount”) and the top of the 15% band (“Maximum 15% Rate Amount”). Adjusted net capital gain above the 15% figure is taxed at 20%.
| Filing status (2026) | 0% rate up to | 15% rate up to | 20% rate above |
|---|---|---|---|
| Married filing jointly / surviving spouse | $98,900 | $613,700 | $613,700 |
| Head of household | $66,200 | $579,600 | $579,600 |
| Single | $49,450 | $545,500 | $545,500 |
| Married filing separately | $49,450 | $306,850 | $306,850 |
| Estates and trusts | $3,300 | $16,250 | $16,250 |
These are taxable-income thresholds, measured after the standard deduction, which for 2026 is $32,200 for joint filers and $16,100 for single filers, before any age-65 additional amount (Source: IRS Rev. Proc. 2025-32, 2025). That deduction is why a couple can often report meaningful gross income and still keep some long-term gains inside the 0% band.
Why ordinary income decides your capital-gains rate
Ordinary income is stacked first, then long-term gains are layered on top, so the 0% and 15% capital-gains bands are consumed by other income before your stock sale ever reaches them (Source: Instructions for Schedule D (Form 1040), 2025). This “bracket stacking” is the single mechanic that explains why realizing gains costs little for some retirees and much more for others.
Traditional IRA and 401(k) withdrawals, required minimum distributions, pension payments, and Roth conversions are all ordinary income. Each dollar of that income raises the floor from which your capital gain is measured, shrinking the space that would otherwise let gains be taxed at 0%.
Here is a simplified 2026 illustration for a married couple filing jointly. It shows how the same $30,000 gain moves between the 0% and 15% bands as ordinary taxable income rises toward the $98,900 ceiling.
| Ordinary taxable income | 0% room remaining to $98,900 | $30,000 gain: taxed at 0% | Portion taxed at 15% |
|---|---|---|---|
| $40,000 | $58,900 | $30,000 | $0 |
| $80,000 | $18,900 | $18,900 | $11,100 |
| $98,900 | $0 | $0 | $30,000 |
Figures use the 2026 joint 0% ceiling of $98,900 (Source: IRS Rev. Proc. 2025-32, 2025) and are illustrative, not tax advice. They show the ordering rule, not a projection of any individual result.
Harvesting gains in the 0% capital-gains bracket
Gain harvesting is the practice of intentionally selling appreciated stock in a year when total taxable income leaves room inside the 0% long-term band, so the realized gain is taxed at 0% (Source: IRS Topic No. 409, 2025; IRS Rev. Proc. 2025-32, 2025). Low-income early-retirement years, before Social Security and RMDs begin, are when that room is often widest.
Selling and immediately repurchasing the same shares can also reset the cost basis higher, because the wash-sale rule restricts losses, not gains. The rules allow a gain to be recognized and the position rebought, which may lower the taxable gain on a future sale. Specific outcomes depend on your circumstances.
One approach some retirees and advisers use to estimate available 0% room is described below. It is a general illustration of the mechanics, not a recommendation or a step a reader should take:
- Projecting total ordinary taxable income for the year (IRA and pension withdrawals, RMDs, interest, and any Roth conversion), after the standard deduction.
- Subtracting that figure from the 2026 filing-status ceiling ($98,900 MFJ or $49,450 single) to find remaining 0% room (Source: IRS Rev. Proc. 2025-32, 2025).
- Identifying long-term lots (held more than one year) whose gain would fit inside that room.
- Considering the side effects, because a gain that fits the 0% band can still raise the taxable portion of Social Security, involve the 3.8% surtax, or affect Medicare premiums.
- Weighing only the amount that would survive those checks, and revisiting the analysis in a later year.
How selling stock can raise the tax on your Social Security benefits
Realizing a stock gain raises adjusted gross income, and that higher AGI can make more of your Social Security benefits taxable, up to 85% of them (Source: 26 U.S.C. §86; IRS Topic No. 423, 2025). This is the effect commonly called the Social Security tax torpedo, and it can push the effective rate on a gain above its stated capital-gains rate.
Under IRC §86, taxability turns on “combined income,” defined as AGI plus tax-exempt interest plus one-half of benefits. Up to 50% of benefits become taxable above the base amount and up to 85% above the adjusted base amount, shown below for 2026.
| Filing status | Up to 50% taxable above | Up to 85% taxable above |
|---|---|---|
| Married filing jointly | $32,000 | $44,000 |
| Single / head of household / other | $25,000 | $34,000 |
| Married filing separately (not apart all year) | $0 | $0 |
These §86 thresholds are statutory and have not been indexed for inflation since the 1983 and 1993 legislation (Source: 26 U.S.C. §86). Because the lines never move, ordinary income growth and one-time gains reach them more easily each year. The interaction between a stock sale and benefit taxation is covered in more depth on the Social Security tax torpedo resource.
The 3.8% net investment income tax on stock sales
The net investment income tax adds 3.8% under IRC §1411 on top of the 15% or 20% capital-gains rate, applied to the lesser of net investment income or the amount by which modified AGI exceeds a fixed threshold (Source: IRS Topic No. 559, 2025). Capital gains count as net investment income, so a large stock sale can trigger it.
The 2026 MAGI thresholds are $250,000 for married filing jointly, $200,000 for single or head of household, and $125,000 for married filing separately (Source: IRS, Net Investment Income Tax, 2025). MAGI for this tax equals regular AGI for most retirees who have no foreign earned income.
These §1411 thresholds are statutory and are not indexed for inflation; the statute contains no cost-of-living provision (Source: 26 U.S.C. §1411(b)). A retiree who realizes a gain that pushes MAGI over the fixed line pays the extra 3.8% on the amount above it, on top of the underlying capital-gains rate. The mechanics and 2026 figures are detailed on the net investment income tax page.
Medicare premiums (IRMAA) and the income you report
A stock gain raises the modified AGI that Medicare uses to set Part B and Part D premiums through the Income-Related Monthly Adjustment Amount, so a single large sale can raise premiums in a later year even after income returns to normal. IRMAA tiers are set annually by the Centers for Medicare and Medicaid Services and are commonly based on a prior tax-year return.
Because IRMAA works from a snapshot of a past return, a one-time gain can lift premiums for a limited window rather than permanently. Current 2026 bracket dollar figures and the premium amounts are maintained on the Medicare IRMAA 2026 brackets and premiums page rather than restated here, so the numbers stay current.
Sequencing stock sales around RMDs and other retirement income
Required minimum distributions are ordinary income and stack under your capital gains the same way Roth conversions do, so the year RMDs begin often shrinks the 0% capital-gains room a retiree previously had (Source: IRS Retirement Topics on RMDs, 2025). The required beginning age is 73 for those who reached age 72 after December 31, 2022, rising to 75 for those reaching 74 after December 31, 2032 (Source: SECURE 2.0 Act §107; IRS Pub. 590-B, 2025).
Because ordinary income and gains compete for the same bracket space, the order and year in which each is realized changes the total tax. One general framework some retirees and advisers use is described below for illustration; it is not a recommendation or a step a reader should follow:
- Mapping the years before RMDs and Social Security begin, where taxable income is often lowest and 0%-bracket room widest.
- Weighing, in a given year, how much bracket space would be occupied by ordinary income versus long-term gains, since one crowds out the other.
- Comparing a potential sale against the Social Security §86 thresholds, the §1411 NIIT lines, and Medicare IRMAA.
- Reassessing the analysis in the year RMDs start, because forced ordinary income can eliminate the 0% gain window entirely.
The same low-income years that favor 0% gain harvesting are the years a Roth conversion can also fill bracket space, and the two strategies draw on the same limited room, so realizing gains and converting in the same year may reduce the amount of each that stays in a low bracket. This is an educational point about coordination, not a recommendation. Detail on RMD rules sits on the required minimum distributions page.
Which shares to sell: holding period and cost basis
Selling specific lots matters because the holding period sets the rate and the cost basis sets the taxable gain. Long-term treatment, with its 0%, 15%, or 20% rates, requires holding the shares more than one year; shares held one year or less are taxed at ordinary rates (Source: IRS Topic No. 409, 2025). Identifying which lots to sell can change the reported gain substantially.
Highly appreciated employer stock inside a workplace plan can follow a separate set of rules through net unrealized appreciation, which may tax part of the value at long-term capital-gains rates instead of ordinary rates. That mechanism is described on the net unrealized appreciation page. The right lot selection depends on each taxpayer’s basis, holding period, and other income, so results vary.
Work with Q3 Advisors
Q3 Advisors is a registered investment adviser focused on retirement tax planning. This article is educational and is not advice; for guidance on your own circumstances, consult a qualified tax or financial professional.
Frequently asked questions
Do you pay taxes when you sell stock in retirement?
Often yes, but not always. Selling stock held more than one year produces a long-term capital gain taxed at 0%, 15%, or 20% based on 2026 taxable income and filing status (Source: IRS Topic No. 409, 2025). A gain that keeps total taxable income at or below $98,900 for joint filers can be taxed at 0% (Source: IRS Rev. Proc. 2025-32, 2025).
How can a retiree pay 0% on capital gains?
The 0% long-term rate applies while 2026 taxable income stays at or below $98,900 for married couples filing jointly or $49,450 for single filers (Source: IRS Rev. Proc. 2025-32, 2025). Because ordinary income fills those brackets first, low-income years before RMDs and Social Security begin often leave the most room for gains at 0%.
Does selling stock affect how my Social Security is taxed?
It can. A realized gain raises adjusted gross income, which can make up to 85% of Social Security benefits taxable once combined income passes the §86 thresholds ($32,000 and $44,000 for joint filers in 2026) (Source: 26 U.S.C. §86; IRS Topic No. 423, 2025). These thresholds are not indexed for inflation, so gains reach them more easily over time.
Does selling stock raise my Medicare premiums?
It can. A stock gain raises the modified AGI Medicare uses to set Part B and Part D premiums through IRMAA, and because IRMAA is commonly based on a prior-year return, a one-time gain can raise premiums in a later year before income normalizes. Current 2026 IRMAA brackets are maintained on the Q3 Advisors Medicare IRMAA page.
What is the net investment income tax on a stock sale?
The net investment income tax adds 3.8% under IRC §1411 to capital gains once modified AGI exceeds $250,000 for joint filers, $200,000 for single filers, or $125,000 for married filing separately (Source: IRS, Net Investment Income Tax, 2025). It applies to the lesser of net investment income or the amount above the threshold, which is statutory and not indexed for inflation (Source: 26 U.S.C. §1411).
Do capital gains count as income in retirement?
Yes. Long-term capital gains are part of taxable income and raise adjusted gross income, even though they carry their own 0%, 15%, or 20% rate rather than ordinary rates (Source: IRS Topic No. 409, 2025). That higher AGI can, in turn, affect the taxation of Social Security benefits, the 3.8% NIIT, and Medicare premiums, depending on your total income.
Sources
IRS Topic No. 409, Capital gains and losses, https://www.irs.gov/taxtopics/tc409
IRS Rev. Proc. 2025-32 (2026 inflation adjustments; capital-gains breakpoints, standard deduction), https://www.irs.gov/pub/irs-drop/rp-25-32.pdf
IRS Topic No. 559 and Net Investment Income Tax, https://www.irs.gov/taxtopics/tc559 and https://www.irs.gov/individuals/net-investment-income-tax
26 U.S.C. §1411 (NIIT), https://www.law.cornell.edu/uscode/text/26/1411
26 U.S.C. §86 and IRS Topic No. 423 (taxation of Social Security benefits), https://www.law.cornell.edu/uscode/text/26/86 and https://www.irs.gov/taxtopics/tc423
IRS Instructions for Schedule D (Form 1040), https://www.irs.gov/instructions/i1040sd
IRS Retirement Topics on RMDs and Pub. 590-B (SECURE 2.0 §107), https://www.irs.gov/retirement-plans/plan-participant-employee/retirement-topics-required-minimum-distributions-rmds and https://www.irs.gov/publications/p590b
IRS Notice 2025-67 (2026 retirement plan limits), https://www.irs.gov/pub/irs-drop/n-25-67.pdf
About the author
Disclaimer
This article is provided by Q3 Advisors for general educational and informational purposes only. It is not investment, tax, or legal advice and is not a recommendation to buy, sell, or hold any security or to pursue any strategy. Tax rules change and apply differently to each person; consult a qualified tax or financial professional about your own circumstances. Q3 Advisors is a registered investment adviser; additional information is available in its Form ADV.