Do Capital Gains Count as Income for Roth IRA Contribution Limits?
Yes, capital gains count toward your MAGI for Roth IRA contribution purposes. Every dollar of realized gain, short-term or long-term, flows into the income calculation the IRS uses to determine your eligibility. For 2024, that threshold starts phasing out at $146,000 for single filers and $230,000 for married filing jointly. One large sale can end your direct contribution eligibility entirely.
This matters more than most people realize. The interaction between capital gains and Roth IRA contributions isn't just a mechanical tax question. For anyone managing a concentrated position, planning a business exit, or executing a portfolio rebalance, it's a sequencing problem with real dollar consequences.
What Is MAGI and How Does It Affect Roth IRA Eligibility?
Modified Adjusted Gross Income is the number the IRS uses to gate Roth IRA access. It starts with your adjusted gross income and adds back certain deductions, including student loan interest, foreign income exclusions, and IRA deductions. For most high earners, MAGI and AGI are nearly identical.
According to IRS Publication 590-A, long-term capital gains are fully included in MAGI for Roth IRA purposes. The preferential tax rate you receive on those gains, 15% or 20% depending on your income bracket, has no bearing on whether they count toward the contribution threshold. They do.
The 2024 phase-out ranges by filing status are:
| Filing Status | Phase-Out Begins | Phase-Out Ends | Full Contribution Limit |
|---|---|---|---|
| Single / Head of Household | $146,000 | $161,000 | $7,000 ($8,000 if 50+) |
| Married Filing Jointly | $230,000 | $240,000 | $7,000 ($8,000 if 50+) |
| Married Filing Separately | $0 | $10,000 | $7,000 ($8,000 if 50+) |
Per IRS Notice 2023-75, the IRS adjusts these thresholds annually for inflation. The 2023 figures were lower. Never assume last year's numbers apply. Verify current limits each January before making contributions.
For married filing separately filers, the phase-out is essentially a cliff. Any MAGI above $10,000 eliminates direct Roth eligibility entirely, making the backdoor route the only viable path.
How Long-Term Capital Gains Affect Your MAGI
The distinction between short-term and long-term gains matters enormously for your tax rate. It matters not at all for MAGI.
Under IRC Section 1(h), long-term gains on assets held over one year receive preferential rates of 0%, 15%, or 20% based on taxable income. For 2024, the 20% rate kicks in for single filers with taxable income above $518,900 and married filing jointly filers above $583,750. Add the 3.8% Net Investment Income Tax that applies when MAGI exceeds $200,000 (single) or $250,000 (married filing jointly), and the effective federal rate on long-term gains for top earners reaches 23.8%.
That 23.8% is still well below the 37% top ordinary income rate applied to short-term gains. On a $2 million gain, the federal tax difference between short-term and long-term treatment exceeds $260,000. Holding a position a few additional weeks to cross the one-year threshold is often worth the wait.
| Gain Type | Holding Period | Top Federal Rate | NIIT Applies? | Effective Top Rate |
|---|---|---|---|---|
| Short-Term | Under 1 year | 37% (ordinary income) | Yes (if MAGI threshold met) | Up to 40.8% |
| Long-Term | Over 1 year | 20% | Yes (if MAGI threshold met) | 23.8% |
| Qualified Dividends | N/A | 20% | Yes (if MAGI threshold met) | 23.8% |
Both types count equally toward your MAGI for Roth IRA purposes. The tax rate difference is real and significant. The MAGI impact is identical.
Can I Still Contribute to a Roth IRA If I Have Large Capital Gains This Year?
Possibly, but you need to run the numbers before year-end, not at tax time.
If your base income plus realized gains pushes MAGI above the phase-out ceiling, direct contributions are off the table. You have three options: reduce your realized gains before year-end, use the backdoor Roth strategy, or skip direct contributions entirely and focus on other tax-advantaged vehicles.
A partial contribution is available if your MAGI falls within the phase-out range. The IRS calculates the reduced contribution amount using a formula: the full contribution limit multiplied by the ratio of how far your MAGI falls below the upper threshold divided by the $15,000 phase-out range (single) or $10,000 range (married filing jointly). If the math produces a number below $200, you can still contribute $200.
If you contributed the full amount early in the year and later realized gains that pushed you over the limit, you have until the tax filing deadline (including extensions) to withdraw the excess contribution plus earnings. Missing that deadline triggers a 6% excise tax on the excess for each year it remains in the account.
Reporting Roth contributions correctly on your 1040 is straightforward, but the excess contribution penalty is easy to miss if you're not tracking MAGI in real time.
The Backdoor Roth Strategy and the Pro-Rata Rule
For anyone above the income thresholds, backdoor Roth strategies are the standard workaround. The mechanics are simple: make a non-deductible contribution to a traditional IRA, then convert that IRA to Roth. No income limit applies to conversions.
The complication is the pro-rata rule under IRC Section 408.
The IRS does not let you cherry-pick which IRA dollars you convert. When you execute a conversion, the taxable portion is calculated across all your traditional, SEP, and SIMPLE IRA balances combined. If you have $500,000 in pre-tax traditional IRA funds and contribute $7,000 in non-deductible dollars, your total IRA balance is $507,000. The non-deductible portion is 1.38%. That means 98.62% of any conversion is taxable, not just the $7,000 you intended to convert tax-free.
This is the most common and costly mistake high-net-worth individuals make with backdoor Roth strategies. Anyone holding rollover IRAs from prior employer 401(k) plans is particularly exposed.
The solution is the reverse rollover: move your pre-tax IRA funds back into your current employer's 401(k) before executing the backdoor conversion. Not all 401(k) plans accept incoming rollovers, so confirm with your plan administrator first. If your plan does accept them, clearing your traditional IRA balance to zero before the conversion eliminates the pro-rata problem entirely.
Calculating conversion basis accurately requires Form 8606, which tracks your non-deductible contributions over time. Keep these records indefinitely.
The Mega Backdoor Roth: Scaling Beyond $7,000
The standard backdoor Roth gets you $7,000 per year. The mega backdoor Roth can get you up to $46,000 more, depending on your plan.
The strategy works through 401(k) plans that permit after-tax contributions beyond the standard $23,000 employee deferral limit. The total 415(c) limit for 2024 is $69,000 (including employer contributions). If your plan allows after-tax contributions and either in-service withdrawals or in-plan Roth conversions, you can contribute the gap between your employer's total contributions and the $69,000 ceiling in after-tax dollars, then convert those funds to Roth status with minimal tax impact.
The tax consequence on conversion is limited to any earnings that accrued in the after-tax account between contribution and conversion. Convert quickly and that number is small.
Business owners have a structural advantage here. If you own your company, you can design your 401(k) plan documents to explicitly permit after-tax contributions and in-plan Roth conversions. A plan document amendment typically costs a few thousand dollars and can unlock tens of thousands in annual Roth accumulation. Quantify this with your CPA before assuming your current plan structure is optimal.
For optimal Roth vs 401k allocation decisions, the mega backdoor Roth changes the math considerably. The question shifts from "Roth or traditional?" to "how much can I get into Roth this year across all available channels?"
Tax-Loss Harvesting to Manage MAGI: What High Earners Get Wrong
Tax-loss harvesting reduces your net capital gains and, by extension, your MAGI. The mechanics are straightforward: sell a position at a loss, use that loss to offset gains, and repurchase a similar (but not substantially identical) security to maintain your market exposure.
The wash-sale rule under IRC Section 1091, detailed in IRS Publication 550, is where execution breaks down. The IRS disallows a harvested loss if you purchase a substantially identical security within 30 days before or after the sale. That's a 61-day window total. The disallowed loss is not gone permanently; it gets added to the cost basis of the replacement security. But it won't reduce your MAGI in the current tax year, which is the point.
Two things high-net-worth investors consistently miss:
First, the wash-sale rule applies across all accounts you own, including your spouse's accounts and all IRAs. Selling a losing position in your taxable account and repurchasing the same security in your Roth IRA within the 61-day window triggers the rule and permanently disallows the loss. Automated tax-loss harvesting platforms from providers like Wealthfront or direct indexing services need household-level wash-sale monitoring across all custodians to function correctly.
Second, losses carry forward indefinitely if they exceed gains in a given year. Long-term losses offset long-term gains first, then short-term gains. Short-term losses offset short-term gains first, then long-term gains. The sequencing affects your tax rate on the remaining gains, not just the total amount. Offsetting capital losses strategically requires tracking both the character and the timing of losses across your full portfolio.
When a Single Transaction Creates a Multi-Year Tax Problem
A business sale, a concentrated stock liquidation, or a real estate exit generating $1 million or more doesn't just push you over the Roth IRA phase-out. It can trigger a cascade of consequences that extend two to three years forward.
The 3.8% NIIT applies to net investment income when MAGI exceeds $200,000 (single) or $250,000 (married filing jointly). That's an additional layer on top of the 20% long-term rate, bringing the effective federal rate to 23.8%.
Medicare Part B and Part D premiums are determined by IRMAA (Income-Related Monthly Adjustment Amount) using a two-year lookback. A $2 million gain in 2024 increases your Medicare premiums in 2026. The top IRMAA tier can add over $4,000 per person per year to Medicare costs, a number that compounds if the gain is large enough.
In high-gain years, the Roth IRA contribution question is often the smallest piece of the problem. Installment sales, charitable remainder trusts, qualified opportunity zone investments, or donor-advised fund contributions may be more impactful levers than worrying about a $7,000 contribution limit.
Tax planning when you stop earning looks different when a single transaction defines your income for the year. The sequencing of these strategies, particularly around charitable giving and installment elections, needs to happen before the transaction closes, not after.
Roth IRA Access Strategies by Income Level
The right approach depends on where your MAGI lands relative to the phase-out thresholds:
| MAGI Range (Single, 2024) | MAGI Range (MFJ, 2024) | Strategy |
|---|---|---|
| Below $146,000 | Below $230,000 | Direct Roth IRA contribution up to $7,000 |
| $146,000 to $161,000 | $230,000 to $240,000 | Partial direct contribution; consider backdoor for remainder |
| Above $161,000 | Above $240,000 | Backdoor Roth (non-deductible traditional IRA + conversion) |
| Any income level | Any income level | Mega backdoor Roth if plan permits after-tax contributions |
| Any income level | Any income level | Roth conversion of existing traditional IRA balances |
Converting a 401k to Roth is a separate decision from annual contribution strategy, but the two interact. Large conversions in low-income years, particularly early retirement years before Social Security or RMDs begin, can be one of the highest-return tax moves available to FatFIRE-level investors. Roth conversions in retirement deserve their own analysis, but the core logic is filling lower tax brackets with conversion income before required minimum distributions force the issue.
What Happens Inside the Roth Doesn't Create the Problem
One clarification worth making explicit: capital gains generated inside a Roth IRA do not affect your MAGI or your contribution eligibility. Tax-free dividend growth in Roth accounts compounds without creating any taxable event, and qualified distributions in retirement don't count as income at all.
The MAGI problem comes entirely from realized gains in taxable accounts. Gains sitting unrealized in any account, Roth or otherwise, have no MAGI impact until you sell.
This distinction matters for asset location decisions. Vanguard research consistently demonstrates that placing high-growth assets in Roth accounts and income-generating assets in tax-deferred accounts improves after-tax returns over multi-decade horizons. The logic extends further: assets you expect to generate large future gains belong in Roth accounts precisely because those gains will never create a MAGI problem or a tax bill.
Understanding Roth principal withdrawals is also relevant here. Contributions (not earnings) can be withdrawn from a Roth IRA at any time without tax or penalty, which gives the account a liquidity characteristic that traditional IRAs lack.
Practical Steps Before Year-End
Run a MAGI projection before December 31, not April 15. You need time to act.
If you're close to the phase-out threshold, your options include: harvesting losses to offset gains, deferring a planned sale into the next tax year, accelerating deductible expenses, or maximizing pre-tax retirement contributions to reduce AGI. A $23,000 401(k) contribution reduces your MAGI dollar for dollar. HSA contributions (up to $4,150 for individuals, $8,300 for families in 2024) do the same.
If you've already exceeded the threshold, execute the backdoor Roth before year-end if your traditional IRA balance is zero or near zero. If you have significant pre-tax IRA balances, solve the pro-rata problem first through a reverse rollover before attempting the conversion.
Engage a CPA who works with high-net-worth clients on these decisions, not a general practitioner. The difference between a well-executed backdoor Roth and a taxable conversion that wipes out the benefit is often a single line on Form 8606. IRS Publication 590-A and 590-B are the primary technical references; your advisor should be working from them, not around them.
References
- Internal Revenue Service -- "Publication 590-A: Contributions to Individual Retirement Arrangements (IRAs)" (2024)
- Internal Revenue Service -- "Publication 590-B: Distributions from Individual Retirement Arrangements (IRAs)" (2024)
- Internal Revenue Service -- "IRC Section 408A – Roth IRAs"
- Internal Revenue Service -- "IRS Notice 2023-75: 401(k) limit increases to $23,000 for 2024, IRA limit rises to $7,000" (2023)
- Internal Revenue Service -- "Topic No. 409: Capital Gains and Losses"
- Internal Revenue Service -- "Revenue Procedure 2023-34: 2024 Inflation Adjustments" (2023)
- Internal Revenue Service -- "Publication 550: Investment Income and Expenses" (2024)
- Internal Revenue Service -- "IRC Section 1(h) – Maximum Capital Gains Rate"
- Vanguard -- "Vanguard's Principles for Investing Success" (2023)
- Journal of Financial Planning -- "Optimal Retirement Account Sequencing for High-Income Earners"
