Capital Gains Tax on Retirement Accounts: 401(k), IRA, and Roth Withdrawals
Learn how capital gains tax applies to 401(k), IRA, and Roth IRA withdrawals. Understand the tax treatment differences and plan your retirement distributions wisely.

How Capital Gains Tax Works With Retirement Accounts
Retirement accounts are one of the most powerful wealth-building tools available to American workers. But there is a widespread misunderstanding about how these accounts interact with capital gains tax. Many people assume that because their 401(k) holds stocks and mutual funds, the growth inside the account is treated as a capital gain. That is not how the IRS sees it. The tax treatment depends entirely on the type of account you hold, not the type of investment inside it.
Before diving into the specifics, it helps to understand the fundamentals of capital gains taxation so you can see where retirement accounts fit into the broader picture. The core distinction is between tax-deferred accounts and tax-free accounts, and each category has very different rules when you start taking money out.
✅ Key Takeaway: Capital gains tax does not apply inside a retirement account. What matters is how the withdrawal itself is taxed — as ordinary income or tax-free — depending on the account type.
Traditional 401(k) and Traditional IRA Withdrawals
A traditional 401(k) and a traditional IRA operate on a simple principle: you contribute pre-tax dollars, the investments grow tax-deferred, and you pay income tax when you withdraw the money in retirement. This means every dollar you take out is taxed as ordinary income, regardless of whether the growth came from stock appreciation, bond interest, or dividend payments.
This is the part that surprises many people. If you contributed 50,000 dollars to a traditional IRA over the years and it grew to 150,000 dollars through stock market gains, the entire 150,000 dollars is treated as ordinary income when you withdraw it. The 100,000 dollars of growth is not taxed at the preferential long-term capital gains rate. It is taxed at your marginal income tax rate, which could be significantly higher.
The reason is simple: you never paid tax on the original contributions. The IRS considers all the money in a traditional retirement account to be "pre-tax." So when it comes out, the entire distribution is treated as ordinary income, regardless of its source. This is an important distinction that many first-time retirees overlook when they start planning their withdrawal strategy.
⚠️ Common Mistake: Do not assume that because your 401(k) holds index funds, the growth will be taxed at capital gains rates. In a traditional 401(k) or IRA, all withdrawals are ordinary income — period.
Required Minimum Distributions and Tax Impact
Starting at age 73, the IRS requires you to begin taking Required Minimum Distributions (RMDs) from traditional 401(k) and IRA accounts. These RMDs are calculated based on your account balance and life expectancy tables published by the IRS. The problem is that RMDs can push you into a higher tax bracket, especially if you have other sources of income like Social Security or a pension.
This is where strategic planning becomes critical. If you have a mix of account types, you can manage your taxable income by choosing which accounts to draw from each year. For example, taking smaller distributions from a traditional IRA and supplementing with Roth withdrawals can keep your adjusted gross income below certain thresholds that trigger higher Medicare premiums or additional surtaxes.
Understanding the capital gains versus ordinary income tax is essential here, because the gap between these two rate structures can cost — or save — you thousands of dollars each year in retirement. The top ordinary income tax rate is 37 percent, while the top long-term capital gains rate is 20 percent. That 17-point gap is enormous when you are drawing down a six-figure retirement account.
Roth IRA and Roth 401(k) Withdrawals
Roth accounts work in the opposite direction from traditional accounts. You contribute after-tax dollars, the investments grow tax-free, and qualified withdrawals are completely free of federal income tax. This means you never pay capital gains tax on the growth inside a Roth account, and you never pay ordinary income tax on withdrawals either, as long as you meet the qualified distribution rules.
To qualify for tax-free withdrawals from a Roth IRA, you must meet two conditions. First, the account must have been open for at least five years. Second, you must be at least 59 and a half years old, permanently disabled, or using the money for a first-time home purchase (up to a 10,000 dollar lifetime limit). If both conditions are met, the entire withdrawal — contributions plus all growth — is tax-free.
This is a remarkable benefit that many investors underestimate. If you contribute 6,000 dollars per year to a Roth IRA for 30 years and it grows to 500,000 dollars, every penny of that 500,000 dollars comes out tax-free. The 322,000 dollars of growth is not taxed as a capital gain, and it is not taxed as ordinary income. It is simply free and clear. This is why Roths are often described as the most tax-efficient retirement account available.
💡 Roth Advantage: Unlike traditional accounts, Roth IRAs have no RMDs during the owner's lifetime. This means you can let the money grow tax-free for decades, creating a powerful estate planning tool.
What Happens With Early Roth Withdrawals
One of the most misunderstood rules about Roth IRAs is the early withdrawal penalty. Because you already paid tax on your contributions, you can withdraw those contributions at any time, for any reason, without penalty or tax. This is called the "ordering rule," and it means your Roth IRA can serve as a backup emergency fund if needed.
However, the earnings portion of a Roth IRA is subject to different rules. If you withdraw earnings before age 59 and a half and before the five-year rule is satisfied, those earnings are taxed as ordinary income plus a 10 percent early withdrawal penalty. This is an important distinction that many people miss when they treat their Roth IRA as a general savings account.
The key takeaway is that contributions come out first, tax-free and penalty-free. Earnings come out last, and they are subject to both tax and penalty if the distribution is not qualified. This ordering rule provides significant flexibility that traditional accounts simply do not offer.
Comparing Tax Treatment Across Account Types

Understanding how different retirement accounts are taxed at withdrawal is essential for making informed decisions about where to save and how to withdraw. The table below summarizes the key differences in tax treatment across the major account types.
| Account Type | Contribution Type | Growth Tax | Withdrawal Tax |
|---|---|---|---|
| Traditional 401(k) | Pre-tax | Tax-deferred | Ordinary income |
| Traditional IRA | Pre-tax (if deductible) | Tax-deferred | Ordinary income |
| Roth 401(k) | After-tax | Tax-free | Tax-free (if qualified) |
| Roth IRA | After-tax | Tax-free | Tax-free (if qualified) |
As you can see, the tax treatment at withdrawal is dramatically different between traditional and Roth accounts. The choice between the two is not just about your current tax bracket — it is about your expected tax bracket in retirement, your other income sources, and your estate planning goals. Many financial advisors recommend having a mix of both types to maximize flexibility in retirement.
Early Withdrawal Penalties and Exceptions
Taking money out of a retirement account before age 59 and a half generally triggers a 10 percent early withdrawal penalty on top of whatever income tax you owe. This penalty applies to both traditional and Roth accounts (on the earnings portion), and it can significantly increase the cost of accessing your retirement savings early.
However, there are several important exceptions to the early withdrawal penalty. The IRS recognizes that life does not always go according to plan, and certain situations warrant penalty-free access to retirement funds. These exceptions include total and permanent disability, substantially equal periodic payments (Section 72(t)), certain medical expenses exceeding a percentage of your adjusted gross income, health insurance premiums while unemployed, and qualified higher education expenses for IRAs.
There is also a relatively new exception worth noting. The SECURE 2.0 Act, passed in late 2022, added several new penalty-free withdrawal categories, including up to 1,000 dollars per year for emergency expenses, expenses related to domestic abuse (up to 10,000 dollars), and withdrawals by terminally ill individuals. These changes provide more flexibility than ever before, but the income tax still applies to traditional account distributions even when the penalty is waived.
⚠️ Important: The 10 percent early withdrawal penalty may be waived in certain situations, but the ordinary income tax on traditional account distributions is never waived. You always owe income tax on pre-tax withdrawals, regardless of your age or reason for the withdrawal.
Strategic Withdrawal Planning for Retirement
How you withdraw money from your retirement accounts can be just as important as how you saved it. A well-designed withdrawal strategy can reduce your total tax bill by tens of thousands of dollars over the course of a long retirement. The key is to think about your income sources as a portfolio, not in isolation, and to manage your taxable income strategically year by year.
One popular approach is called "tax bracket management." The idea is to fill up the lower tax brackets with traditional account withdrawals while keeping your total income below the next bracket threshold. You then supplement with Roth withdrawals to meet your spending needs without pushing into a higher bracket. This approach works especially well in the early years of retirement, before RMDs begin and before Social Security starts.
Another strategy involves legal strategies to minimize capital gains tax and ordinary income tax in retirement. For example, you might realize capital gains in a taxable brokerage account during years when your income is low, taking advantage of the zero percent capital gains rate that applies to taxpayers in the 10 or 12 percent ordinary income brackets. This is sometimes called "tax gain harvesting," and it can be a powerful complement to your retirement account withdrawal strategy.
Roth Conversions as a Planning Tool
Roth conversions are one of the most powerful tools in retirement tax planning. A Roth conversion involves moving money from a traditional IRA or 401(k) into a Roth account. You pay ordinary income tax on the converted amount in the year of the conversion, but all future growth in the Roth account is tax-free, and qualified withdrawals are never taxed again.
The ideal time to do a Roth conversion is during a year when your income is unusually low. This might happen in the gap between retirement and the start of Social Security, or during a year when you have large deductions such as medical expenses. By converting during a low-income year, you pay tax at a lower rate than you might in future years, and you lock in tax-free growth for decades to come.
Be aware that Roth conversions increase your adjusted gross income for the year, which can have ripple effects on other parts of your tax return. You might trigger the Net Investment Income Tax of 3.8 percent, lose eligibility for certain deductions and credits, or increase your Medicare premiums through the Income-Related Monthly Adjustment Amount (IRMAA). These are all factors to consider when calculating whether a conversion makes financial sense.
🏆 Pro Tip: Run the numbers before doing a Roth conversion. Use tax software or work with a CPA to model the total tax cost of the conversion, including effects on Medicare premiums, NIIT, and other income-based thresholds. The conversion might still be worth it, but you should make that decision with full information.
How State Taxes Affect Retirement Withdrawals
While this article focuses on federal tax treatment, state taxes are another important consideration. Most states follow the federal treatment of retirement account distributions, but there are significant exceptions. Some states exempt certain types of retirement income from state taxation, while others tax all withdrawals at the state level.
For example, Pennsylvania does not tax retirement account distributions for taxpayers over a certain age. Florida, Texas, and Nevada have no state income tax at all, making them attractive retirement destinations. Other states, like California and New York, fully tax retirement account distributions at their state income tax rates. If you are considering relocating in retirement, the state tax treatment of your retirement income should be a factor in your decision.
You can learn more about this topic by reviewing the state capital gains tax rates that apply in your state. Even though retirement account withdrawals are not technically capital gains, the state-level tax landscape is relevant because many states apply similar rates and rules to all types of investment income.
Special Considerations for Seniors and Retirees
Retirees face a unique set of tax challenges that younger workers do not. The interaction between retirement account withdrawals, Social Security benefits, Medicare premiums, and required minimum distributions creates a complex web of income-based thresholds that can be difficult to navigate without careful planning.
One of the most common pitfalls is the taxation of Social Security benefits. If your combined income — defined as your adjusted gross income plus nontaxable interest plus half of your Social Security benefits — exceeds certain thresholds, up to 85 percent of your Social Security benefits become taxable. Retirement account withdrawals directly increase your combined income, which can push more of your Social Security into taxable territory.
For more detailed guidance on this topic, check out our article on capital gains tax planning for seniors and retirees, which covers the specific strategies that older taxpayers can use to minimize their overall tax burden while maintaining the income they need.
Key Takeaways for Retirement Account Tax Planning
📋 Traditional 401(k) and IRA withdrawals are always taxed as ordinary income, regardless of how the money grew inside the account. Capital gains tax does not apply.
📋 Roth IRA and Roth 401(k) qualified withdrawals are completely tax-free. No capital gains tax, no ordinary income tax, and no early withdrawal penalty if the rules are met.
📋 Roth IRA contributions can be withdrawn at any time, tax-free and penalty-free, because you already paid tax on that money.
📋 Early withdrawal penalties of 10 percent apply to most pre-retirement distributions, but there are more exceptions than most people realize.
📋 Roth conversions can be a powerful tax planning tool, especially in low-income years, but they must be analyzed carefully for ripple effects on other parts of your return.
📋 Strategic withdrawal sequencing — drawing from the right accounts at the right time — can save you thousands of dollars per year in retirement.
Final Thoughts
Retirement account taxation is one of those areas where a little knowledge goes a long way. The basic rules are straightforward once you understand them, but the strategic implications are deep and far-reaching. Whether you are decades from retirement or already taking distributions, the way you manage your retirement accounts can have a six-figure impact on your after-tax wealth.
The most important thing is to avoid the common mistake of treating all retirement accounts the same. Traditional accounts are tax-deferred, not tax-free, and every dollar you withdraw will be taxed at ordinary income rates. Roth accounts are genuinely tax-free, and they deserve a prominent place in any tax-efficient retirement plan. By understanding these differences and planning accordingly, you can keep more of your hard-earned money working for you throughout retirement.
If you want to dive deeper into the mechanics of calculating your tax liability on investment gains, read our guide on h[how to calculate capital gains tax for a step-by-step walkthrough of the entire process.
Fact-Checked & Reviewed
This article was written by Wasim Akram (Independent Web Publisher & Digital Entrepreneur) and reviewed for accuracy by David Chen (JD, LLM in Taxation (New York University)). Published by Wasim Akram, Founder & Lead Researcher at TaxGainsCalc. All tax rates, thresholds, and rules referenced are based on IRS publications and current tax law as of the date published. Tax laws change frequently — always consult a qualified tax professional for advice specific to your situation.

Founder & Lead Researcher, TaxGainsCalc
Wasim Akram is an independent web publisher and digital entrepreneur based in India. Since 2018, he has been building custom CMS platforms, WordPress plugins, niche websites, and AI-powered digital products with over 8 years of real-world experience....
Tax Attorney & Legal Editor
David Chen is a tax attorney with a Juris Doctor and a Master of Laws in Taxation from New York University School of Law. With over 10 years of legal practice, he specializes in 1031 exchanges, capital gains tax law, and IRS dispute resolution. David...

Founder & Lead Researcher, TaxGainsCalc
Wasim Akram is an independent web publisher and digital entrepreneur based in India. Since 2018, he has been building custom CMS platforms, WordPress plugins, niche websites, and AI-powered digital products with over 8 years of real-world experience....
Disclaimer: This article is for informational purposes only and does not constitute tax, legal, or financial advice. Tax laws and regulations change frequently, and the information presented here may not reflect the most current updates. You should consult with a qualified CPA, tax attorney, or financial advisor before making any tax-related decisions. TaxGainsCalc is not responsible for any actions taken based on the information provided in this article.


