Do Capital Gains Count Towards MAGI? Thresholds and Timing

Yes, capital gains do count toward MAGI. When you sell stock, a mutual fund, or real estate at a profit, that gain enters your adjusted gross income, and because every version of modified adjusted gross income is built on top of AGI, the gain carries into every eligibility calculation the IRS runs.1Internal Revenue Service. Modified Adjusted Gross Income A single windfall can push your MAGI past thresholds that raise Medicare premiums, disqualify you from Roth IRA contributions, or wipe out ACA premium subsidies.

How a Capital Gain Reaches Your MAGI

Federal tax law defines gross income to include “gains derived from dealings in property,” which covers every type of capital gain.2Office of the Law Revision Counsel. 26 USC 61 – Gross Income Defined Sell an asset for more than you paid, and the profit gets reported on Schedule D and then flows into Form 1040 at line 7, where it becomes part of your AGI.3Internal Revenue Service. Schedule D (Form 1040) – Capital Gains and Losses MAGI is built on top of AGI, so those gains are baked in from the start. No MAGI formula strips capital gains back out once they’ve entered AGI.

This holds whether you held the asset for six months or six years. Short-term and long-term gains are taxed at different rates, but both increase your MAGI by the full amount of the profit. A $10,000 gain adds $10,000 to your MAGI either way.

Only Realized Gains Count

Your MAGI reflects only the gains you’ve actually locked in by selling. If your portfolio climbs $50,000 during the year but you don’t sell a share, that growth is an unrealized gain with zero effect on your tax return. Paper profits don’t enter AGI.

That distinction hands you a timing lever. You decide when to sell, which means you decide when the gain shows up. Someone approaching a MAGI limit for Roth eligibility might delay a sale of appreciated stock until January, shifting the income into the next tax year. Someone with ACA subsidies at stake might spread a large sale across two calendar years to keep each year’s MAGI under the threshold.

Assets inside tax-deferred accounts like a 401(k) or traditional IRA follow the same principle. You can buy and sell inside those accounts all year without generating a reportable gain. Income shows up only when you take a distribution, and it’s taxed then as ordinary income rather than as a capital gain.

The Home Sale Exclusion

One meaningful boundary: if you sell your primary home and qualify for the home sale exclusion, you can exclude up to $250,000 of gain ($500,000 for married couples filing jointly) from your income entirely.4Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence The excluded portion never hits AGI, so it never touches MAGI. Any gain above the exclusion does count, and in expensive markets, the overage can be substantial.

MAGI Is Not a Single Number

MAGI is not one universal figure. The IRS calculates it differently depending on which program or tax benefit is at stake, noting that “the specific items and how to calculate them depend on what the MAGI is for.”1Internal Revenue Service. Modified Adjusted Gross Income Every version starts with AGI, so every version already contains your capital gains. What differs is which items get added back on top.

For Roth IRA eligibility, MAGI adds back the traditional IRA deduction, student loan interest deduction, foreign earned income exclusion, foreign housing deduction, and excluded savings bond interest, among other items.5Internal Revenue Service. Publication 590-A, Contributions to Individual Retirement Arrangements For ACA Marketplace coverage, MAGI equals AGI plus untaxed foreign income, non-taxable Social Security benefits, and tax-exempt interest.6HealthCare.gov. What to Include as Income For Medicare premium surcharges, MAGI is simply AGI plus tax-exempt interest.7Social Security Administration. HI 01101.010 – Modified Adjusted Gross Income (MAGI) When you’re planning around a specific threshold, run the right formula.

Where Capital Gains Hit Hardest in 2026

Roth IRA Contributions

The 2026 IRA contribution limit is $7,500, with an $1,100 catch-up for those 50 and older.8Internal Revenue Service. 401(k) Limit Increases to $24,500 for 2026, IRA Limit Increases to $7,500 Roth contributions phase out on MAGI:

  • Single filers: full contribution below $153,000, partial from $153,000 to $168,000, none at $168,000 or above.
  • Married filing jointly: full below $242,000, partial from $242,000 to $252,000, none at $252,000 or above.

A capital gain that pushes you into or through the phase-out reduces or eliminates your Roth contribution for the year. If you’ve already contributed and later discover your MAGI is too high, you’ll owe a 6% penalty on the excess every year it stays in the account until corrected.

Net Investment Income Tax

The net investment income tax adds 3.8% on top of your regular capital gains rate when MAGI exceeds $200,000 (single) or $250,000 (married filing jointly).9Office of the Law Revision Counsel. 26 USC 1411 – Imposition of Tax Gains get hit twice here: they count as investment income (the thing being taxed) and they inflate MAGI (the trigger). These thresholds have never been adjusted for inflation since the tax took effect in 2013. A married couple with $230,000 in salary and a $25,000 stock gain crosses the $250,000 line and owes 3.8% on the portion of investment income above it.

Medicare Premium Surcharges

Medicare Part B and Part D premiums rise when MAGI clears certain thresholds through a surcharge called IRMAA. For 2026, the base threshold is $109,000 for individual filers and $218,000 for joint filers.10Centers for Medicare and Medicaid Services. 2026 Medicare Parts A and B Premiums and Deductibles Surcharges range from $81.20 per month at the lowest bracket up to $487.00 per month at the highest.

The detail that blindsides retirees: IRMAA uses a two-year lookback. Your 2026 premiums are based on your 2024 return.7Social Security Administration. HI 01101.010 – Modified Adjusted Gross Income (MAGI) Sell a rental property or cash out a large stock position in 2024 and you won’t feel the premium increase until 2026. A single filer with MAGI between $205,000 and $500,000 pays an extra $446.30 per month in Part B surcharges alone.10Centers for Medicare and Medicaid Services. 2026 Medicare Parts A and B Premiums and Deductibles

ACA Subsidies and the EITC

If you buy Marketplace coverage, your premium subsidy is tied to household MAGI relative to the federal poverty level.6HealthCare.gov. What to Include as Income A gain large enough to push you above 400% of the poverty level can reduce or wipe out the subsidy. Starting in 2026, there are no repayment caps on excess advance premium credits. If you received subsidies based on an income estimate and a late-year gain pushes your actual MAGI higher, you’ll owe back the full difference at filing.11Internal Revenue Service. Questions and Answers on the Premium Tax Credit In prior years, caps limited the damage. That safety net is gone.

The Earned Income Tax Credit carries a separate tripwire. EITC eligibility depends on both AGI and investment income. If your capital gains and other investment income exceed roughly $12,200 for 2026, you’re disqualified from the credit regardless of how low your earned income is.12Internal Revenue Service. Earned Income and Earned Income Tax Credit (EITC) Tables

How Capital Losses Pull MAGI Back Down

Sell an asset for less than you paid, and the loss offsets your gains dollar for dollar. A $10,000 gain paired with a $7,000 loss leaves $3,000 of net gain in AGI. If losses exceed gains, you can deduct up to $3,000 of the excess against other income each year ($1,500 if married filing separately).13Office of the Law Revision Counsel. 26 USC 1211 – Limitation on Capital Losses That deduction reduces AGI before MAGI is calculated, so it pulls down every version of MAGI at once. Net losses beyond the $3,000 cap carry forward indefinitely.

There’s a catch. The wash sale rule blocks the loss if you buy the same or a substantially identical security within 30 days before or after the sale.14Office of the Law Revision Counsel. 26 USC 1091 – Loss From Wash Sales of Stock or Securities The rule reaches across all your accounts, including IRAs and your spouse’s accounts. Sell at a loss on December 15 and repurchase on January 5, and the loss is disallowed even though the trades span two tax years. Tax-loss harvesting works, but only if you wait out the 30-day window or replace the position with something that isn’t substantially identical.

Timing a Sale Around a MAGI Threshold

Because only realized gains count, you have more control than you might think. Some moves that experienced investors use:

  • Spread large sales across tax years. An installment sale on a rental property with a $200,000 gain can keep each year’s MAGI below the thresholds that matter.
  • Harvest losses before December 31. Selling underperformers in the same year as a big gain reduces net capital gains in AGI.
  • Watch the calendar near retirement. IRMAA’s two-year lookback means a large gain at 63 hits your Medicare premiums at 65. Completing the sale before or after the lookback window can save meaningful premium costs.
  • Estimate before you sell. Run projected MAGI with the gain included. A $20,000 gain that triggers $5,000 in IRMAA surcharges, kills a $4,000 ACA subsidy, or creates a 3.8% NIIT bill may be worth deferring.

None of this erases the tax on your gains. It manages when the income appears and which thresholds it trips. For anyone sitting near a phase-out boundary, the difference between selling in December and selling in January can be worth thousands in lost credits, higher premiums, or additional tax.