Capital gains do not count as income for a Roth IRA contribution. The IRS requires “taxable compensation” — money you earned from working — before you can put a dollar into a Roth, and profits from selling stocks, real estate, or other investments fall outside that definition. Capital gains do, however, count toward your Modified Adjusted Gross Income (MAGI), so a large gain in a single year can push you past the income ceiling and shrink or eliminate your contribution even when your paycheck would otherwise qualify you.
What the IRS Counts as Compensation
Your Roth IRA contribution for the year is capped at the lesser of the annual dollar limit or your taxable compensation. For 2026, the annual limit is $7,500, or $8,600 if you are 50 or older.1Internal Revenue Service. 401(k) Limit Increases to $24,500 for 2026, IRA Limit Increases to $7,500 If you earned $4,000 from work during the year, $4,000 is the most you can contribute, no matter how much your brokerage account made on top of that.
Taxable compensation is money you received for work you personally performed. The common forms are wages, salaries, tips, bonuses, and commissions shown 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 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 squarely in that excluded group. The IRS draws a hard line between income you earn through personal effort and income your money earns for you, and gains fall on the investment side regardless of whether they’re short-term or long-term, large or small.
If your only income in a given year comes from selling investments, you have zero qualifying compensation and cannot contribute to a Roth IRA at all. Every $1 of contribution needs at least $1 of earned income reported on your tax return.
How Capital Gains Can Still Block Your Contribution
Even though capital gains can’t help you qualify, they absolutely can disqualify you. Gains flow into your Adjusted Gross Income, which feeds directly into your MAGI.3Internal Revenue Service. Modified Adjusted Gross Income – Section: Roth and Traditional IRA Contributions Once your MAGI crosses the phase-out range for your filing status, your allowable Roth contribution shrinks, and above the top of the range it hits zero.
For 2026, the phase-out ranges are:
- Single or head of household: $153,000 to $168,0004IRS.gov. 2026 Amounts Relating to Retirement Plans and IRAs, as Adjusted for Changes in Cost-of-Living
- Married filing jointly: $242,000 to $252,0001Internal Revenue Service. 401(k) Limit Increases to $24,500 for 2026, IRA Limit Increases to $7,500
- Married filing separately (lived with spouse at any time during the year): $0 to $10,000
Below the lower number, you can make a full contribution. Above the upper number, direct Roth contributions are off the table. In between, you calculate a reduced limit. The single-filer phase-out spans $15,000 while the joint range spans only $10,000, so married couples lose eligibility faster once they cross the threshold.
This is the scenario that trips people up. You earn a $120,000 salary, comfortably within the single-filer limit, then sell a rental property for a $40,000 gain. Your MAGI jumps to $160,000 and you’re deep in 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 or irregular gains should run the MAGI math before contributing, not after.
Fixing an Excess Contribution
An excess contribution is any amount above your dollar limit, above your taxable compensation, or any contribution at all when your MAGI exceeds the top of the phase-out range. Leaving it in the account triggers a 6% excise tax reported on Form 5329, and that penalty repeats every year the excess remains.5Internal 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 cleanest fix is pulling the excess contribution and its attributable earnings out of the Roth before your tax return due date, including extensions.6Internal Revenue Service. 2025 Instructions for Form 5329 – Additional Taxes on Qualified Plans (Including IRAs) and Other Tax-Favored Accounts – Section: Part IV Done in time, the contribution is treated as if it never happened and the 6% penalty doesn’t apply. The earnings portion is taxable in the year the contribution was made, and if you’re under 59½ it also faces the 10% early distribution penalty.7Internal Revenue Service. Retirement Topics – Exceptions to Tax on Early Distributions
If you already filed your return without correcting the excess, you get an automatic six-month extension from the original due date to fix it by filing an amended return. For calendar-year filers that means October 15. Write “Filed pursuant to section 301.9100-2” at the top of the amended return.6Internal Revenue Service. 2025 Instructions for Form 5329 – Additional Taxes on Qualified Plans (Including IRAs) and Other Tax-Favored Accounts – Section: Part IV
The other option is recharacterizing the Roth contribution as a traditional IRA contribution by the same deadline. The money and attributable earnings move to a traditional IRA and the IRS treats it as though you contributed there in the first place. Recharacterization makes sense when your MAGI landed higher than expected but you still want the money inside a retirement account. The traditional contribution may or may not be deductible depending on your income and workplace plan coverage.
No Earned Income? The Spousal IRA Route
If you have no compensation of your own but your spouse does, you aren’t necessarily locked out. Under the Kay Bailey Hutchison Spousal IRA rules, a non-working spouse can contribute to a Roth IRA when 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 can’t exceed the working spouse’s total compensation.
The joint MAGI phase-out still applies. 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 A large capital gain on the joint return counts toward that MAGI and can shut down the spousal contribution the same way it would your own.
Over the MAGI Ceiling? The Backdoor Roth
If capital gains or a high salary push your MAGI above the top of the phase-out range, the backdoor Roth is a two-step workaround. 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 ends up in a Roth regardless of MAGI.
You contribute to a traditional IRA on a nondeductible (after-tax) basis, then convert that balance to a Roth shortly afterward. Because you didn’t deduct the contribution, the conversion is largely tax-free; you only owe tax on any earnings between the contribution and conversion, which is usually small if you convert quickly.
There is a serious pitfall. If you already hold money in any traditional, SEP, or SIMPLE IRA, the IRS applies a pro-rata rule. It treats all your traditional IRA balances as one pool and taxes any conversion based on the ratio of pre-tax to after-tax dollars across every account.8Internal 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 moved came from a brand-new nondeductible contribution. The cleanest backdoor conversions happen when your traditional IRA balance is zero before you start.
Timing Your Contribution Around a Big Gain
You don’t have to contribute during the calendar year itself. The IRS allows contributions for a given tax year up to the tax filing deadline the following April, so your 2026 contribution can wait until April 15, 2027. That window is valuable in a year when you expect significant capital gains but won’t know the final figure until late December.
If you contribute early and a later gain pushes your MAGI over the limit, you still have time to withdraw or recharacterize the excess before the filing deadline. The outcome you want to avoid is contributing, forgetting, and discovering the problem years later with 6% penalties stacked behind it.