Yes, capital gains affect Social Security taxation. When you sell an investment at a profit, the realized gain lands in your Adjusted Gross Income, which raises a figure called provisional income. Once provisional income crosses certain thresholds, up to 50% and then up to 85% of your Social Security benefits become taxable.1Office of the Law Revision Counsel. 26 USC 86 – Social Security and Tier 1 Railroad Retirement Benefits Unrealized gains on paper do nothing. The tax consequences start the moment you sell.
How a Gain Reaches Your Social Security
The IRS decides what share of your benefits is taxable using a single number: provisional income. The formula adds your Adjusted Gross Income, any tax-exempt interest (usually from municipal bonds), and half of the Social Security benefits you received during the year.2Internal Revenue Service. Social Security Income
Capital gains enter through AGI. When you sell a stock, mutual fund, or piece of real estate at a profit, the gain shows up on Form 1040 as part of AGI.3Internal Revenue Service. Instructions for Form 1040 Whether the gain qualifies for the lower long-term rate or gets taxed at ordinary income rates makes no difference here. The full amount counts toward AGI, and therefore toward provisional income. Qualified dividends behave the same way: preferential tax rates, but fully included in AGI.
That gives retirees one real planning lever: control over the timing and size of realized gains.
The Thresholds That Trigger Taxation
The thresholds are set by federal statute and have not been adjusted since 1993.1Office of the Law Revision Counsel. 26 USC 86 – Social Security and Tier 1 Railroad Retirement Benefits They are not indexed for inflation, so each year more retirees cross them.
Single filers and heads of household:
- Below $25,000 in provisional income: none of your benefits are taxable.
- $25,000 to $34,000: up to 50% of your benefits become taxable income.
- Above $34,000: up to 85% of your benefits become taxable income.
Married couples filing jointly:
- Below $32,000: none of your benefits are taxable.
- $32,000 to $44,000: up to 50% become taxable.
- Above $44,000: up to 85% become taxable.
Married taxpayers who file separately and lived with their spouse at any point during the year face a $0 threshold, meaning up to 85% of benefits are immediately taxable regardless of income.4Internal Revenue Service. IRS Reminds Taxpayers Their Social Security Benefits May Be Taxable If you file separately but lived apart from your spouse for the entire year, you use the single-filer thresholds.5Internal Revenue Service. Publication 915 – Social Security and Equivalent Railroad Retirement Benefits
The 85% figure is a ceiling. No matter how high your income climbs, the IRS will never tax more than 85% of your Social Security benefits.1Office of the Law Revision Counsel. 26 USC 86 – Social Security and Tier 1 Railroad Retirement Benefits
What a Single Gain Can Do (The “Tax Torpedo”)
Here is why retirees sometimes call this the tax torpedo. Consider a married couple filing jointly who receive $36,000 in Social Security and have $24,000 in pension income. Their provisional income is $24,000 plus half of their benefits ($18,000), for a total of $42,000. That falls in the 50% tier, putting roughly $5,000 of their Social Security on the tax return.
Now suppose the same couple sells a stock for a $60,000 long-term capital gain. Provisional income jumps to $102,000, well past $44,000. Up to 85% of their $36,000 in benefits, or $30,600, is now taxable. The gain itself is taxed at preferential rates, but it has pulled an extra $25,000-plus of Social Security into ordinary income. The real cost of the sale is the capital gains tax plus the ordinary income tax on the newly taxable benefits, stacked.
The Home Sale Carve-Out
Selling a primary residence is often the biggest capital gain event of a retiree’s life, and most of it usually stays off the tax return. You can exclude up to $250,000 of gain if you’re single, or up to $500,000 if you’re married filing jointly, as long as you owned and used the home as your primary residence for at least two of the five years before the sale.6Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence
Excluded gain never appears on your return. It is not included in AGI and does not raise provisional income.7Internal Revenue Service. Selling Your Home A married couple selling for a $400,000 profit who qualify for the full $500,000 exclusion see no effect on Social Security taxation.
The exposure comes from gain above the exclusion, or from failing the two-year ownership and use test. A $350,000 gain on a single filer’s home puts $100,000 into AGI. Verify eligibility well before closing; a six-figure surprise addition to AGI can push benefits deep into the 85% tier.
How Losses Offset the Hit
Losses from investment sales offset gains dollar for dollar, directly reducing the net capital gain that flows into AGI. Sell one position at a $40,000 gain and another at a $25,000 loss, and only $15,000 of net gain reaches your AGI.
If total losses for the year exceed total gains, the IRS caps the amount you can deduct against other income at $3,000 per year, or $1,500 if married filing separately.8Internal Revenue Service. Topic No. 409, Capital Gains and Losses Excess losses carry forward. Harvesting losses in the same year you take gains gives you much more provisional income relief than carrying losses forward and applying $3,000 at a time.
Ways to Keep Provisional Income Down
Every tactic below targets the same goal: keep provisional income under a threshold, or at least out of the 85% tier, in any given year.
Harvest Losses in the Same Year as Gains
Selling losing positions in the same calendar year as a profitable sale offsets the gain in AGI. You don’t need to wait for December. Watch the wash sale rule: repurchasing a substantially identical security within 30 days before or after the loss sale disallows the loss.
Spread Gains Across Multiple Years
Selling an entire position at once creates a one-year provisional income spike. Breaking the sale into tranches over two or three years keeps each year’s gain smaller. For real estate, an installment sale lets you recognize gain only as payments arrive, spreading the AGI impact across the term of the note.9Internal Revenue Service. Topic No. 705, Installment Sales
Time Gains Around When You File for Benefits
If you have not started collecting Social Security yet, large gains are far less costly, because there are no benefits to drag into taxable territory. Realizing gains before you file, or in a year when a pension or Required Minimum Distribution happens to be smaller, gives you more room before you cross a threshold.
Hold Growth Assets in Roth Accounts
Gains realized inside a Roth IRA or Roth 401(k) never appear on your tax return. Qualified Roth distributions are tax-free and excluded from AGI, so they add nothing to provisional income. Holding your most aggressive growth investments in Roth accounts means the appreciation will never contribute to Social Security taxation. Roth conversions of traditional IRA assets accomplish the same long-term goal, though the conversion itself raises AGI in the year you convert.
Use Qualified Charitable Distributions
If you’re 70½ or older and would otherwise take Required Minimum Distributions from a traditional IRA, routing them directly to charity as a Qualified Charitable Distribution keeps the money out of AGI. For 2026, you can transfer up to $111,000 per person this way. The distribution satisfies your RMD but is excluded from gross income, lowering AGI and provisional income dollar for dollar, which frees room to absorb a capital gain.
Stay Within the 0% Capital Gains Bracket
For 2026, single filers with taxable income up to $49,450 and joint filers up to $98,900 pay 0% federal tax on long-term capital gains.10Internal Revenue Service. Revenue Procedure 2025-32 If your other income is low enough, you can realize gains each year within this bracket, paying no capital gains tax while keeping the provisional income increase manageable.
Medicare Premiums Get Pulled In Too
Capital gains don’t stop at Social Security taxation. They also feed Medicare’s Income-Related Monthly Adjustment Amount (IRMAA), which sets your Part B and Part D premiums based on Modified Adjusted Gross Income.11Social Security Administration. Modified Adjusted Gross Income (MAGI)
For 2026, single filers with MAGI above $109,000 and joint filers above $218,000 pay surcharges on top of the standard Part B premium of $202.90 per month. At the top tier, the monthly Part B premium reaches $689.90, with another $91.00 added to Part D.12Centers for Medicare & Medicaid Services (CMS). 2026 Medicare Parts A and B Premiums and Deductibles
IRMAA uses tax data from two years prior. Your 2026 premiums are built from your 2024 return. A large capital gain in 2024 can inflate Medicare costs in 2026 even if your income has since dropped. If the spike came from a qualifying life-changing event such as retirement, divorce, or the death of a spouse, Form SSA-44 lets you request a recalculation. A one-time investment sale by itself does not qualify.
The 3.8% Net Investment Income Tax
Higher-income retirees face another layer. The Net Investment Income Tax adds 3.8% on top of your regular capital gains rate once Modified Adjusted Gross Income exceeds $200,000 (single) or $250,000 (married filing jointly).13Internal Revenue Service. Net Investment Income Tax Capital gains count as net investment income for this purpose. These thresholds are also not indexed for inflation. A single large sale can trigger capital gains tax, the 3.8% NIIT, and ordinary income tax on up to 85% of Social Security benefits all at once.
State Taxes May Follow
Roughly nine states impose their own income tax on Social Security benefits as of 2026, most with exemptions tied to age or income: Colorado, Connecticut, Minnesota, Montana, New Mexico, Rhode Island, Utah, and Vermont. West Virginia finished a multi-year phase-out and fully exempts benefits starting with 2026 returns. In those states, a capital gain that lifts your state AGI can also expose more of your benefits at the state level. Everywhere else, the state either has no income tax or fully exempts Social Security.