Do Capital Gains Count as Income for a Roth IRA?

Capital gains do not count as income for a Roth IRA contribution. The IRS requires “taxable compensation” — money you earned by working — before you can put a dollar into a Roth, and profits from selling stocks, real estate, or other assets sit outside that definition. Worse, capital gains work against you from the other side: they’re included in the Modified Adjusted Gross Income (MAGI) figure the IRS uses to phase out Roth eligibility, so a big gain can shrink or wipe out your contribution room even when your paycheck alone would clear the limits.

What Counts as Compensation for a Roth IRA

Your Roth contribution for any year is capped at the lesser of the annual dollar limit or your total taxable compensation. For 2026, that annual limit is $7,500, or $8,600 if you’re 50 or older.1Internal Revenue Service. 401(k) Limit Increases to $24,500 for 2026, IRA Limit Increases to $7,500 Earn only $4,000 in compensation, and $4,000 is the ceiling on what you can contribute, no matter how much investment income landed on top.

Taxable compensation means money you received for work you personally performed. That includes wages, salaries, tips, bonuses, and commissions in Box 1 of your W-2. Net self-employment earnings qualify after subtracting the deductible portion of self-employment tax and any retirement plan contributions made on your behalf. Taxable alimony received under a divorce decree executed on or before December 31, 2018, and nontaxable military combat pay also count.2Internal Revenue Service. Publication 590-A (2025), Contributions to Individual Retirement Arrangements (IRAs)

What doesn’t count: interest, dividends, rental income, pension or annuity payments, deferred compensation, and earnings from property.2Internal Revenue Service. Publication 590-A (2025), Contributions to Individual Retirement Arrangements (IRAs) Capital gains sit in that excluded category.

Why Capital Gains Are Excluded

The IRS draws a hard line between income you earn through personal effort and income your money earns for you. Selling stock at a profit doesn’t involve providing a service to anyone; the asset simply appreciated. The rule doesn’t care whether the gain is short-term or long-term, or how large it is.

The consequence is sharpest for retirees and early-retirement investors who live on portfolio income. If your only income for the year comes from selling investments, you have zero qualifying compensation and cannot contribute to a Roth IRA at all. Even a $1 contribution requires at least $1 of earned income from work or self-employment on your return.

How Capital Gains Can Still Block Your Contribution Through MAGI

Here’s where gains bite from the other direction. They can’t help you qualify, but they can absolutely disqualify you. Capital gains flow into Adjusted Gross Income, which feeds MAGI directly.3Internal Revenue Service. Modified Adjusted Gross Income – Section: Roth and Traditional IRA Contributions Cross certain thresholds and your allowable Roth contribution shrinks; go far enough and it hits zero.

The 2026 phase-out ranges by filing status:

Below the lower number, you can contribute the full amount. Above the upper number, direct Roth contributions are off the table. In between, you calculate a reduced limit. The single-filer band spans $15,000; the joint band spans only $10,000, so married couples lose eligibility faster once they cross the threshold.

This is the scenario that catches people off guard. You earn a $120,000 salary, comfortably within the single-filer window, then sell a rental property for a $40,000 gain. Your MAGI jumps to $160,000 and drops you into the phase-out zone. If you already made a full Roth contribution earlier in the year, part or all of it is now an excess contribution. Investors with large, irregular capital gains should run the MAGI math before contributing rather than after.

Spousal IRA: An Option If You Don’t Have Earned Income

No earned income of your own doesn’t automatically lock you out. Under the Kay Bailey Hutchison Spousal IRA rules, a non-working spouse can contribute to a Roth IRA as long as the couple files jointly and the working spouse’s taxable compensation covers both contributions.2Internal Revenue Service. Publication 590-A (2025), Contributions to Individual Retirement Arrangements (IRAs) Combined contributions for both spouses can’t exceed the working spouse’s total compensation for the year.

The married-filing-jointly MAGI phase-outs still apply. For 2026, the couple’s MAGI must stay under $252,000 for any Roth contribution and under $242,000 for a full one.1Internal Revenue Service. 401(k) Limit Increases to $24,500 for 2026, IRA Limit Increases to $7,500 Capital gains on the joint return count toward that MAGI, so an investment windfall can shut down a spousal contribution as easily as your own.

The Backdoor Roth IRA

If capital gains or a high salary push your MAGI past the upper limit, the door isn’t permanently shut. A “backdoor Roth” is a two-step workaround high earners have used for years. There’s no income limit on contributing to a nondeductible traditional IRA, and no income limit on converting a traditional IRA to a Roth. Combine the two and money reaches a Roth account regardless of MAGI.

The steps: contribute to a traditional IRA on a nondeductible (after-tax) basis, then convert that balance to a Roth IRA shortly afterward. Because the original contribution wasn’t deducted, the conversion is largely tax-free. You owe tax only on any earnings that built up between the contribution and the conversion, which is usually minimal if you convert quickly.

One major pitfall. If you already hold money in any traditional, SEP, or SIMPLE IRA, the IRS applies a pro-rata rule to the conversion. It treats all your traditional IRA balances as one combined pool and taxes the conversion proportionally based on the ratio of pre-tax to after-tax dollars.5Internal Revenue Service. Rollovers of After-Tax Contributions in Retirement Plans If your combined traditional IRA balances total $100,000 and $80,000 of that is pre-tax, roughly 80% of any conversion is taxable, even if the specific dollars you converted came from a brand-new nondeductible contribution. The cleanest backdoor conversions happen when your pre-tax traditional IRA balance is zero going in.

What to Do If a Capital Gain Made Your Contribution Excess

An excess contribution happens when you deposit more than your annual dollar limit, more than your taxable compensation, or any amount when your MAGI exceeds the upper phase-out threshold. Leave it alone and the IRS charges a 6% excise tax each year it sits in the account, reported on Form 5329.6Internal Revenue Service. Form 5329 – Additional Taxes on Qualified Plans (Including IRAs) and Other Tax-Favored Accounts – Section: Part IV Additional Tax on Excess Contributions to Roth IRAs The penalty repeats every year until you fix it.

The straightforward fix is pulling the excess contribution and any earnings it generated out of the Roth before your tax return due date, including extensions.7Internal Revenue Service. 2025 Instructions for Form 5329 – Additional Taxes on Qualified Plans (Including IRAs) and Other Tax-Favored Accounts – Section: Part IV Do it in time and the contribution is treated as though it never happened, with no 6% penalty.

Already filed without removing the excess? You get an automatic six-month extension from the original due date (not the extended due date) to fix it by amended return. For calendar-year taxpayers, that’s an October 15 deadline. Write “Filed pursuant to section 301.9100-2” at the top of the amended return.7Internal Revenue Service. 2025 Instructions for Form 5329 – Additional Taxes on Qualified Plans (Including IRAs) and Other Tax-Favored Accounts – Section: Part IV

Your custodian calculates the earnings attributable to the excess. Those earnings are taxable in the year the contribution was made, and if you’re under 59½, the earnings portion also faces the 10% early distribution penalty. The IRS specifically excludes returned-contribution earnings from the exception that shields the contribution itself.8Internal Revenue Service. Retirement Topics – Exceptions to Tax on Early Distributions

A second option is recharacterizing the Roth contribution as a traditional IRA contribution, which moves the money and attributable earnings into a traditional IRA as if that’s where they’d gone originally. The deadline is the same: your tax return due date, including extensions. Recharacterization of contributions remains available even though the Tax Cuts and Jobs Act eliminated recharacterization of Roth conversions. Whether the traditional contribution ends up deductible depends on your income and workplace plan coverage; if it’s nondeductible, the backdoor conversion above is a possible next step, subject to the same pro-rata rule.

Wait Until You Know Your MAGI Before Contributing

You don’t have to contribute during the calendar year. The IRS allows Roth contributions for a given tax year up to the following April’s filing deadline, so your 2026 contribution can wait until April 15, 2027. That window is valuable if you expect significant capital gains but won’t know the final number until late December.

If you contributed early and then booked a gain that lifted your MAGI over the ceiling, you still have time to withdraw or recharacterize the excess before the filing deadline. The worst outcome is contributing, forgetting, and finding the problem years later with 6% penalties stacked behind it.