Bogleheads:Sandbox

It is a common investment decision whether to use a traditional or Roth account. You must make this decision if your employer offers both a traditional and Roth 401(k), or when you can deduct a traditional IRA contribution or use a Roth IRA, or when you consider leaving money in a traditional account or converting some to Roth. The better option is the one that gives you the most spendable income after all taxes are paid.

In a traditional retirement account such as a deductible traditional IRA or traditional 401(k), your contributions are deductible, no tax is paid on account growth while the money remains in the account, and withdrawals are taxed as ordinary income. In a Roth retirement account such as a Roth IRA or Roth 401(k), your contributions are not deductible, but all future growth and withdrawals are tax-free in retirement  The approach that incurs a lower marginal tax rate will, in most cases, provide you more spendable income. Neither is inherently better, as either one may be a better investment choice in different situations. Here are some of the considerations.

General guidelines
See Prioritizing investments for general investment considerations.

For deductible traditional vs. Roth contributions, or current vs. future traditional withdrawals (e.g., to convert traditional to Roth), one needs to compare a known tax rate now vs. an estimated tax rate later. If one does not believe a reasonable estimate is possible (see estimating future marginal tax rate for suggestions), consider
 * Using 100% traditional because, for most people, traditional will be better
 * Using 50% traditional and 50% Roth because then you can't be more than 50% wrong

Assuming you have an estimate for your future marginal tax rate, prefer traditional when your current marginal rate is higher than that estimate, and prefer Roth when your current marginal rate is lower.

These guidelines apply to Roth vs. fully tax-deferred traditional accounts. Within employer-sponsored accounts (401k, 403b, 457) the eligibility of traditional vs. Roth is unaffected by income.

With IRAs, the eligibility of traditional vs. Roth is affected by income. There is an income limit for deducting contributions to a traditional IRA. Above that limit, and below the Roth IRA contribution income limit, a Roth IRA is best. Above the Roth IRA income contribution limit, one may choose either the backdoor Roth IRA contribution process or a Non-deductible traditional IRA - see those pages for more details.

Calculations
The main reason to prefer one type of account over the other is the comparison of marginal tax rates.

Simplest situation
For the same contribution amount and growth, the after-tax value is entirely determined by the marginal tax rate on contributions and withdrawals. You can calculate the amount you get after taxes as:

$$ \begin{align} traditional = Original\ amount * Growth\ factor * (1 - withdrawal\ tax\ rate) \\ Roth = Original\ amount * (1 - contribution\ tax\ rate) * Growth\ factor \end{align} $$

The "Growth factor" can be calculated as (1 + r)^t, where r is the annual rate of return and t is the time in years. Because one may choose identical investments regardless of whether held in a traditional or Roth account, the "Growth factor" is the same in each case.

If your marginal tax rate now (the "contribution tax rate") is higher than your marginal tax rate in retirement (the "withdrawal tax rate"), then the traditional account is better; if it is lower, then the Roth account is better.

When the withdrawal tax rate is the same as the contribution tax rate (a.k.a. the marginal tax rate that would be saved by a traditional contribution), thanks to the commutative property of multiplication (i.e., A * B * C = A * C * B) the traditional and Roth results are equal.

More complicated situations
The simple analysis above is valid for many situations, but it does make assumptions that aren't always applicable. Two notable exceptions are summarized below. In both cases, the breakeven withdrawal tax rate (i.e., the rate at which traditional and Roth contributions provide the same spendable result) is somewhat lower than the marginal tax rate that would saved by the traditional contribution. {breakeven\ withdrawal\ tax\ rate} = \frac{(traditional\ marginal\ tax\ rate) - (Roth\ marginal\ tax\ rate)}{(1 - Roth\ marginal\ tax\ rate)} $$ For the derivation of that formula, see Saver's credit. Note that when the Roth tax rate is 0 the formula reduces to the simple case.
 * 1) When the pre-tax amount one wants to use is greater than the contribution limit. E.g., with $25K pre-tax, a 24% tax rate, and a $19K 401k limit, all the after-tax $19K would go into a Roth 401k, but not all the pre-tax $25K can fit into a traditional 401k.  The $6K that doesn't fit is subject to 24% tax, and the remaining $4,560 goes into a taxable account, where it is subject to tax on annual dividends and then capital gains when withdrawn. For more details, including a formula one could use to calculate the breakeven withdrawal tax rate, see Maxing out your retirement accounts. Two spreadsheets are available to calculate how much the withdrawal tax rate could be below 24% and Roth still be preferable:
 * 2) *The 'Misc. calcs' tab (near row 150) in the Personal finance toolbox. Direct link: 2019 Case Study Spreadsheet
 * 3) *Traditional versus Roth (401(k) or IRA)
 * 4) When the saver's credit applies and one gets a tax reduction from Roth contributions.  In short, the breakeven withdrawal tax rate is $$

Common misconceptions
There are two common misconceptions, one that incorrectly favors traditional, and one that incorrectly favors Roth.

The first misconception is sometimes described as "contributions are taken from the top tax rate and are withdrawn later at the average rate". In other words, that one saves a marginal rate when contributing but pays only an average rate (starting at 0% for the first dollar withdrawn) when withdrawing. Following is an example of why that is not true.

Consider a 50 year old who has already accumulated a $500 traditional balance. Even without any further contributions, that could reasonably double to $1 million by age 65. Taking a 4%/yr withdrawal then gives $40K/yr. Any traditional contributions at age 51 (or later) will increase the traditional balance at age 65, thus allowing more than $40K/yr withdrawal. The taxation on the amount above $40K/yr will occur at the marginal rate on that amount, not the effective rate on the total income.

The second misconception is that "it's better to pay tax on the seed than the harvest." In other words, that it is better to pay a lesser tax amount now to make a Roth contribution, instead of a larger amount of tax later on a traditional withdrawal. This is not true because taking a percentage of the "seed" is the same as letting the full seed grow and then taking the same percentage of the "harvest." The result will be the same in either case. The goal should not be to pay as little tax as possible. The goal should be to have as much money leftover after taxes as possible. Comparing marginal rates between contribution (or conversion now) and withdrawal in the future is the most direct way to achieve this goal.

Calculating marginal tax rate now
Your marginal tax rate now is relatively easy to determine. It is not necessarily your tax bracket, because of phase-ins and phase-outs of tax benefits (e.g., various credits and Taxation of Social Security benefits) and tax-like costs (e.g., Expected Family Contribution and Medicare premiums); see Marginal tax rate for a more detailed explanation, and Traditional versus Roth examples for examples.

One can use any commercial tax software to calculate the tax change for the maximum contribution or conversion amount considered. If the (change in tax) divided by (change in income) does match one of the nominal tax brackets (e.g., 12%, 22%, 24%, etc.), that is all one need know. If one gets a different answer, more work is needed: using small ($100 or so) changes in income to determine at what point(s) (change in tax) divided by (change in income) gets a new result. This can be done by hand, or using a tool such as the Personal finance toolbox that will provide answers in chart form.

Estimating future marginal tax rate
Estimating your marginal tax rate in retirement is considerably harder than for today. For one, tax laws may change, and the further you are from retirement, the more likely this becomes. As a starting point, it makes sense to assume the current tax code will still be in place in retirement. But if you have strong feelings that taxes will go up or down in the future, you could make adjustments to these numbers. In any case, you should account for inflation by adjusting the investments' expected rates of return for the predicted inflation rate.

You will need to estimate your taxable retirement income. Consider any expected changes in income over the course of your career. Certain careers are characterized by long periods of low-income training followed by much higher earnings; other careers have early periods of high income followed by more uncertainty.

One approach (based on Investment Order):
 * 1) Estimate any guaranteed retirement income.  E.g., pension you can't defer in return for higher payments when you do start, rentals, royalties, etc.
 * 2) Take current traditional balance and predict value at retirement (e.g., with Excel's FV function) using a conservative real return, maybe 3% or so.  Take 4% of that value as an annual withdrawal.
 * 3) Take current taxable balance and predict value at retirement (e.g., with Excel's FV function) using a conservative real return, maybe 3% or so.  Take 2% of that value as qualified dividends.
 * 4) Decide whether Social Security (SS) income should be considered, or whether you will be able to do enough traditional->Roth conversions before starting SS. Include SS income projections if needed.
 * 5) Calculate marginal rate on withdrawals from traditional accounts using today's tax law on the numbers from step 1-4.
 * 6) Make your traditional vs. Roth decision for this year's contribution
 * 7) Repeat steps 1-6 every year until retirement

The steps above may look complicated at first, but you don't need great precision. The answer will either be "obvious" or "difficult to choose". If the latter, it likely won't make much difference which you pick, so you might choose to mix traditional and Roth contributions, to take advantage of tax diversification.

When estimating retirement income, note the following possibilities: If you pick traditional and that ends up being wrong it will be because you have "too much money" - not the worst problem. If you pick Roth and that ends up being wrong it will be because you have "too little money" - that can be a problem. Thus using traditional is a "safer" choice.
 * Predict high taxable retirement income > contribute to Roth > get low taxable retirement income
 * Predict low taxable retirement income > contribute to traditional > get high taxable retirement income

If you currently have very little tax-deferred retirement savings, your calculated retirement tax rate will be very low, so you’ll get a big value by contributing more. In fact, due to the federal standard deduction, the first $13,850 or $27,000 you withdraw in retirement each year (assuming you're over age 65 at the time) should be tax-free. Assuming a 4% withdrawal rate, that corresponds to an account balance of $346,250 (= $13,850 / 4%) or $675,000 (= $27,000 / 4%) that can be accessed federally tax-free, and these figures should grow with inflation.

As your tax-deferred balance rises, so will your expected tax rate, but as long as it’s less than your marginal tax rate now it still makes sense to contribute to tax-deferred accounts. If your expected retirement marginal tax rate ever reaches or exceeds your current marginal tax rate, and you still want to save more, then additional savings should be done in a Roth account.

Example
A single investor earns $200,000 gross income and has a marginal tax rate of 32%. He plans to retire in 25 years at age 65. He currently has $150,000 in traditional (tax-deferred) savings, expected to grow at 8% after fees, and assumes 3% inflation. He also has a $50,000 taxable account with an expected growth of 8%, a yield of 2%, and a dividend tax rate of 15%. He also expects to take $3,000 per month inflation-adjusted Social Security benefit immediately after retiring. He does not expect any additional income in retirement. His 401(k) allows either traditional or Roth contributions; which should he be making? His predicted retirement marginal tax rate could be calculated as follows:

Under the current tax bracket structure, his future marginal rate with that income is predicted to be only 22.2%, and since his current marginal rate is 32%, he should prefer traditional contributions to Roth for the current year. He should repeat this analysis each year, accounting for actual investment growth and tax law changes.

Qualitative considerations

 * If you already have a large traditional account or expect a large pension (and you expect to take that pension shortly after retiring), your future rate may be relatively high.
 * If you are currently living in a high-tax state and plan to retire to a lower-tax or tax-free state, your future rate may be relatively low. If you currently live in a low-tax state and plan to retire to a high-tax state, your future rate may be relatively high.
 * If you expect to leave most of your traditional account to charity, the marginal rate on that contribution is 0%.
 * If you expect to leave most of your traditional account to heirs, you should consider their likely marginal rates on inherited distributions.
 * Very high earners, who are in or near the top tax bracket now and expect to remain there in retirement, should prefer Roth.

You should perform any Roth conversions in low-income years when your withdrawal tax rate will be relatively low. Examples include a year with a job loss, in retirement prior to receiving Social Security and a pension, and prior to large Required Minimum Distributions (RMDs) from a tax-deferred account.

In general, most retirees have the same or lower marginal tax rate than when they were working, and thus should prefer a traditional account to a Roth of the same type. When you retire, you will only pay tax on income earned outside a retirement account, and on the money you actually withdraw. In addition, if any of your retirement spending comes from Roth accounts, it will not be taxed, and if it comes from taxable capital gains or qualified dividends, it will be taxed at a lower rate than your ordinary income. Therefore, you can spend the same amount but have less taxable income.

For these reasons, in the absence of a more rigorous analysis, most investors should prefer traditional contributions during their peak earning years. For those seeking a more detailed estimate, see the analysis method described previously.

State taxes
Consider state taxes as well as federal taxes in your tax rate comparisons, both for the state you live in and for the state you expect to retire in.

Some states do not allow deductions for traditional account contributions, or only allow them for some types of contributions (New Jersey, for example, allows deductions for 401(k) but not 403(b) or IRA contributions); if you live in such a state, the Roth has an advantage. If your state allows a deduction but you might retire in a state which has no tax or will not tax your Traditional IRA withdrawals, then the Traditional IRA has a potential advantage; conversely, if your state has no income tax but you might retire in a state which taxes Traditional IRA withdrawals, the Roth has a potential advantage.

Estate planning
For those planning on leaving a significant estate to their heirs, multigenerational affects should be considered. For example, if you are a high earner in the 32% tax bracket, and expect to be throughout retirement, but your heirs are lower earners in the 12% tax bracket, you should prefer Traditional contributions - your heirs will receive a larger inheritance after tax. Likewise, if you are in a lower tax bracket than your heirs, you should prefer to contribute to Roth accounts. If you plan to bequeath assets to a tax-exempt charity, that bequest should be from a Traditional account as opposed to a Roth, because neither you nor the charity will pay taxes on the funds, and the charity will receive a larger donation.

The federal estate tax exemption, $11.4M for individuals and $22.8M for married couples as of 2019, applies regardless of whether the accounts being bequeathed are traditional or Roth. Because Roth dollars are worth more than traditional dollars, investors who expect to be close to the estate tax exemption limit should prefer Roth investments, and/or perform Roth conversions to get their estate value under the exemption. Even if there is a marginal tax rate disadvantage, your heirs will likely receive more after taxes by avoiding double taxation.

Opportunity to convert later
If you contribute to a traditional IRA, you can convert to a Roth IRA in a later year. If you contribute to a traditional 401(k) and leave your employer, you can roll the 401(k) into a traditional IRA and then convert it later, or roll it directly to a Roth IRA. Your income (and therefore marginal tax rate) might be lower in a year when you separate from an employer. In either case, you may come out ahead if you can convert in a lower tax bracket, because you pay the taxes in the year of conversion instead of the year of contribution.

This increases the benefit from using traditional accounts when you retire in a low tax bracket. If you retire in a 12% tax bracket before taking Social Security, and don't need the whole 12% tax bracket for living expenses, you can convert part of your Traditional IRA to a Roth at 12%, reducing the amount you will have in the IRA when you start taking Social Security.

But if you expect to retire in the same tax bracket, this is not a significant extra advantage for the traditional accounts. If you are usually in a 22% tax bracket and retire in a 22% tax bracket but happen to have some years in a 12% bracket (large deductions, unemployed part of the year, one spouse takes off from work or works part-time to care for children), you can convert up to the top of the 12% bracket in those years, and you can make those conversions from any traditional accounts you have, whether or not you have Roth accounts.

Required Minimum Distributions
Traditional accounts have the disadvantage of having Required Minimum Distributions (RMDs) begin at age 70.5. (Roth 401(k)'s have RMD's as well, but can easily be rolled over into a Roth IRA upon retirement , and Roth IRA's do not have RMD's). RMD's are a reasonable percentage of the account balance, but if you expect to want to leave large IRAs as part of your estate and RMD's would hinder this goal, then prefer Roth contributions.

Tax risk
If all else is equal (that is, you expect to retire in the same bracket, and never to have the opportunity to convert in a lower bracket), the Roth account has a slight advantage because there is less tax risk. You might not retire with the same marginal tax rate that you expect, either because tax rates change or because your taxable income is higher or lower.

Another risk for MFJ filers is the death of one spouse, leaving the survivor with single filing status and its higher marginal rates. This risk would be mitigated if the spouse's death substantially reduced household expenses.

Tax diversification
Tax Diversification is the principle that having assets spread across different kinds of accounts (Traditional, Roth, taxable, etc). The further you are from retirement, the harder it is to predict what tax law will be. By diversifying between current and future tax rates, you effectively provide yourself insurance against large tax rate changes (up or down). Also, it may be the case that there will be certain steep phase-outs, or "bumps" in marginal rates in the future (eg. the current Social Security taxation bumps), and having the flexibility to control your taxable income to some degree might allow you to better optimize around future tax laws. Conversely, if you only have Traditional investments, you will be required to withdraw RMD's or whatever you need to live on, and pay whatever tax results. Even if the Traditional vs. Roth analysis described above favors one type or the other, there is a potential advantage to having a mix.

Investment options
You may have different investment options in traditional and Roth accounts. If your employer offers a Traditional 401(k) but not a Roth 401(k), then you must use Traditional accounts if you invest in the 401(k). If you are over the income limit for a deductible Traditional IRA, then you must use a Roth account if you invest in an IRA (a non-deductible IRA cannot be better than either a deductible or Roth account). The choice of account, or benefits within the account, may be more important than the different tax treatment of traditional and Roth accounts.

Employer match
If your employer matches 401(k) contributions, this is by far the best investment you can make, as it has an immediate return equal to the match rate. Therefore, regardless of the quality of your employer's plan, you should get the maximum match before investing anywhere else.

If your employer offers both traditional and Roth accounts, any match goes to a traditional account, and the match is calculated without regard to whether your contribution is traditional or Roth. Therefore, if you cannot contribute enough to a Roth account to get the maximum match, then you should prefer traditional contributions because you can get a larger match for the same out-of-pocket (after-tax) cost.

For example, assume you are in a 12% tax bracket and your employer will match 100% of your contributions up to $4,000, and you can only afford to contribute $3,000 out-of-pocket.

By contributing $3,409 (= $3,000 / (1 - 12%)) to the traditional 401(k), your after-tax cost is the same as a $3,000 Roth contribution, but you get an additional $409 match.

Investment quality and fees
Many 401(k) plans, and even more retirement plans of other types such as 403(b) plans, have inferior investment options. If you invest in high-cost funds in a 401(k), you will usually lose more to the high costs than you can gain from any tax difference between the 401(k) and IRA. Some plans have only high-cost options; in such a plan it is better to max out your IRA (Traditional or Roth) before making unmatched contributions to the 401(k). Other plans have some low-cost options, but have no options or high-cost options in some asset classes; in such a plan, you should prefer to invest enough in an IRA (Traditional or Roth) to cover the asset classes with no good option in the 401(k). Once your IRA is maxed out, it is usually worth contributing even to a bad 401(k). Conversely, some retirement plans, such as the Thrift Savings Plan, have better options than are available to retail investors in IRAs. If you have such a plan, you may prefer that plan to an IRA, even at a tax cost. Investment quality and tax considerations can be combined into the same calculation, by using the Growth_factor in addition to the marginal tax rates.

Example
You can either contribute $5,000 pre-tax earnings to a Traditional 401(k) or a Roth IRA. Your marginal tax rate is 22% now, predicted to be 12% in retirement. The investment is expected to grow at 8% before fees in either case, but the Traditional 401(k) charges a 1.00% expense ratio, and the Roth IRA charges a 0.04% expense ratio. Either investment would be withdrawn in 20 years. The future after-tax values of the two investments will be as follows:
 * Traditional 401(k): $5,000 * (1 + 8% - 1%)^20 * (1 - 12%) = $17,026.61
 * Roth IRA: $5,000 * (1 + 8% - 0.04%)^20 * (1 - 22%) = $18,043.56.

Assuming the investments are held for the full 20 year term, the fees in the 401(k) outweigh the tax savings, and the Roth IRA is a superior investment. However, the tax savings from the Traditional contribution is immediate, whereas the fees reduce performance gradually over time. In this circumstance, if you expected to separate from your employer well before the 20 year term, you could roll the 401(k) into either a low-expense Traditional IRA, or the 401(k) at your new employer. Depending on how long the money remained in the high-expense 401(k), you might come out ahead contributing to the 401(k) now.

Social Security benefits
One important exception is the phase-in of taxation of Social Security benefits. If you are in the phase-in range, you may experience a marginal rate in retirement of 22.2% or 40.7% despite being in the 12% or 22% brackets. The 22.2% "bump" affects Social Security recipients with annual Social Security benefits less than $18,236 (Single) or $51,118 (Married Filing Jointly), and the 40.7% bump affects those receiving more than these values. See the main article for more details on where these formulas come from, and for useful visualizations of the phase-in effects. As a function of annual Social Security benefit (SS), the 22.2% bump begins and ends at the following levels of income from other sources:

As a function of annual Social Security benefit (SS), the 40.7% bump begins and ends at the following levels of income from other sources:

The 40.7% bump is more abrupt, because it's bracketed by 22.2% below and 22% above. The 22.2% bump is bracketed by 18% below and 12% above. If you are reasonably close (10-15 years or less) to retirement and are in the benefits and income range where you may be affected by either bump, you should try to either come in under the bump, or go far above it, depending on which option is easier. For those making Traditional contributions, switching to Roth to lower taxable income in retirement might be the easiest option.

Example
A single investor, age 55, earns $80,000 gross income and has a marginal tax rate of 22%. He plans to retire in 10 years. He currently has $650,000 in Traditional (tax-deferred) savings, expected to grow at 6% after fees, and has been making $12,000 annual contributions. He has no significant taxable investments. He expects to receive a $2,500 per month inflation-adjusted Social Security benefit starting upon retirement at age 65. He does not expect any additional income in retirement, from part-time work, investments income, rental properties, pensions, etc. His 401(k) allows either Traditional or Roth contributions; which should he be making? Assuming that roughly 50% of his Social Security benefit is taxable, his predicted retirement marginal tax rate could be calculated as follows:

By inspection of just the tax bracket structure, his future marginal rate would be 22%, the same as today, so it would seem that Traditional and Roth contributions would be equally valuable. His future income would be only slightly above the start of the 22% bracket ($39,475), so he might choose to favor Traditional in case his predictions were off. However, the picture changes when considering Social Security taxation. Because he receives more than $18,236 annual benefit, he is susceptible to the 40.7% bump. Using the above formulas, the bump begins and ends at the following levels of other income:

Unfortunately, his $40,444 Traditional withdrawals put him right in the middle of the 40.7% bump. If he instead contributes $10,000 per year to his 401(k) as Roth for the next 10 years, his future income from Traditional accounts will be reduced to $34,942 (=FV(6%-3%,10,0,-650000)*4%), keeping him below the 40.7% bump. He will still be in the 85% phase-in range for Social Security, but will be in the 12% bracket, so his marginal tax rate in retirement will be 22.2% (12% * (1 + 85%)). Roth contributions are by far the better choice.

Straddling brackets
Note that the marginal tax rates now and in the future can be affected by the amount contributed to Traditional accounts. For example, contributing the full $19,000 to a Traditional 401(k) might bring an investor down from the 32% bracket into the 24% bracket. Likewise, contributing more to Traditional accounts might raise the predicted future marginal tax rate such that it might cross into a higher bracket. In these cases, the Traditional vs. Roth analysis should be done for each dollar invested; contributions can be divided in any proportion. The higher the investment performance, longer the time horizon, and higher the contribution limit to Traditional accounts, the more likely straddling becomes.

Example
A married couple earns $400,000 gross income and plans to retire in 30 years. They currently have $350,000 in traditional (tax-deferred) savings, expected to grow at 9% after fees. They plan to contribute $75,000 total to their 401(k) accounts, $37,000 of which can be traditional only, and the remaining $38,000 can be either traditional or Roth. They also have a $50,000 taxable account, to which they expect to contribute $5,000 per year, with an expected growth of 8%, a yield of 2%, and a dividend tax rate of 15%. They expect to each receive a $3,000 per month inflation-adjusted Social Security benefit, of which 85% will be taxable. They do not expect any additional income in retirement, from part-time work, investments income other than tax drag from the taxable account, rental properties, pensions, etc. Should they make traditional or Roth 401(k) contributions with their $38,000 per year? For fully traditional contributions, their predicted retirement marginal tax rate could be calculated as follows:

Assuming the current tax system remains in effect, their future marginal rate is predicted to be 32%. Their current marginal tax rate with full Traditional contributions would be 24% (taxable income = $400,000 - $37,000 - $38,000 - $24,400 = $300,600). It appears as though they should prefer Roth contributions.

However, if the calculation is run assuming 100% Roth contributions, the result is different:

Their future marginal rate would therefore be only 24%, and their current marginal rate with full Roth contributions would be 32% (taxable income = $400,000 - $37,000 - $24,400 = $338,600), the opposite of before. The optimal solution is to split contributions between Traditional and Roth contributions. For simplicity, we can check six possible proportions, although in practice, spreadsheet or optimization software could automate this calculation to be more precise:

By splitting the contribution, this couple can lower their total taxes by staying within the 24% bracket both now and in retirement. Note that this analysis is extremely imprecise; it depends on future contributions being made, investments performing as expected, and the tax code remaining the same, most of which are very unlikely to occur. However, current tax rates are well-known, so if the optimum traditional contribution is close to a step down in marginal rate, it's usually a good idea to contribute just up to that step, then contribute the rest to Roth. In this case, a traditional contribution of $17,150 is probably best, as it puts the couple's taxable income exactly at the 24%/32% bracket boundary at $321,450. They would therefore also contribute $20,850 ($38,000 - $17,150) to Roth.

Maxing out your retirement accounts
The IRS sets a maximum contribution to retirement accounts. If you have reached this maximum, anything else you contribute must be in a taxable account that will (if you pay more than 0% on annual earnings or capital gains) lose money to taxes not incurred in either a Traditional or Roth account. The IRS contribution limits do not distinguish between Traditional (pre-tax) and Roth (after-tax) accounts. Because after-tax money is worth more than pre-tax money, Roth accounts effectively allow you to contribute more than Traditional accounts. For example, if your marginal tax rate is 32%, a $19,000 Roth 401(k) contribution will tax-shelter $27,941.18 ($19,000 / (1 - 32%)) of pre-tax earnings, whereas a Traditional 401(k) contribution can only tax-shelter $19,000. A fair comparison between Roth and Traditional contributions when at a fixed-dollar limit must therefore also take into account the performance of the remaining money in a taxable account. The after-tax amount invested in the taxable account is simply the tax savings from the traditional contribution, in this case $6,080.00 ($19,000 * 32%). The future after-tax values of the Traditional account plus the taxable account can then be compared to the Roth account.

The equivalent conversion decision would be to convert a $19,000 traditional IRA to a Roth IRA, paying the $5320 tax with money that would otherwise have been invested in a taxable account.

Example
You are deciding between traditional and Roth contributions in your 401(k), with a contribution limit of $19,000. Your marginal rate now is 24%, your marginal rate in retirement is predicted to be 22%, your tax rate on dividends and long-term capital gains are both 15%. Your investments in any account are expected to have annual capital growth of 6% and a yield of 2%, for 8% total return, compounding annually. You plan to withdraw the money in 25 years. If you invest in Roth, you can effectively contribute $25,000 ($19,000 / (1 - 24%)) of pre-tax earnings, and your future after-tax value will be:

$$$25,000 \cdot (1 - 24%) \cdot (1 + 8%)^{25} = $19,000 \cdot (1 + 8%)^{25} = $130,121.03$$

If you invest $19,000 in Traditional, your future Traditional after-tax value will be:

$$$19,000 \cdot (1+8%)^{25} \cdot (1 - 22%) = $101,494.40$$

In addition, you will invest the remaining $4,560 tax savings ($19,000 * 24%) in a taxable account. After 25 years, the value of the taxable investment will grow to:

$$$4,560 \cdot (1+8%-(2% \cdot 15%))^{25} = $29,131.14$$

The basis of this investment will be:

$$$4,560 + \left ( \frac{$4,560 \cdot 2% \cdot (1-15%)}{8%-(2% \cdot 15%)} \right ) \left ( (1+8%-(2% \cdot 15%))^{25}-1 \right ) = $9,984.80$$

When sold, the future after-tax value of the investment will be:

$$$29,131.14 - ($29,131.14 - $9,984.80) \cdot 15% = $26,259.19$$

Finally, we compare the two results and see that the Roth investment has an advantage, despite having an apparent disadvantage due to the higher marginal tax rate now:


 * Roth = $130,121.03
 * Traditional + taxable = $101,494.40 + $26,259.19 = $127,753.59

If the analysis were repeated with a wider spread in tax rates (eg. 22% and 12%, or 32% and 24%) then Traditional would retain the advantage. It's also worth noting that the Traditional and taxable investments both retain more flexibility for the future. The Traditional investment may be later converted to Roth, and the taxable investment may be sold and withdrawn without penalty at any time.

Break-even withdrawal rate
See Roth 401(k) vs. 401(k) Spreadsheet Critique for derivation details of the following formula.

$$ \begin{align} d & = \text{annual return from dividends and interest (yield)} \\ g &= \text{annual return from growth} \\ i &= \text{total annual return (= g + d)} \\ T &= \text{marginal tax rate for traditional contribution now} \\ T1 &= \text{tax rate on dividends} \\ T2 &= \text{tax rate on capital gains} \\ e &= \text{annual taxable return, including tax effect (= i – d*T1)} \\ n &= \text{number of years invested} \\ f &= \text{effective capital gains tax rate, including added basis from dividends (= T2 * g / e)} \\ R &= \text{breakeven tax rate at withdrawal (Roth favorable for withdrawal tax rate above this)} \\ \end{align} $$

$$R = T \cdot \frac{(1 + e)^n * (1 - f) + f}{(1 + i)^n}$$

In the example case, the breakeven rate is calculated as follows:

$$R = 24% \cdot \frac{(1 + 7.7%)^{25} * (1 - 11.69%) + 11.69%}{(1 + 8%)^{25}} ~= 20.2%$$ as also shown by one of the spreadsheets referenced earlier:



Very high earners
Very high earners, who will be at or near the top tax bracket during working years and retirement, should generally prefer Roth contributions for three reasons:
 * The main benefit of traditional contributions - saving taxes at a higher rate now and paying a lower rate at withdrawal - disappears when you are in the top tax bracket now and in retirement.
 * Higher tax rates, including the Net Investment Income Tax (NIIT), degrade the long-term performance of taxable investments, shifting the balance of "Roth vs. traditional + taxable" in favor of Roth for those who contribute the maximum to retirement accounts.
 * Investors with high marginal tax rates can tax-shelter lots more income with Roth than Traditional. A high earner with a 50.3% marginal tax rate (37% federal and 13.3% state) can tax-shelter $38,229.38 ($19,000 / (1 - 50.3%)) per year with a Roth contribution, more than double than with a traditional.

Saver's credit
Saver's Credit is effectively a match from the IRS on your retirement contributions if you have a relatively low income. The credit is given for contributions to either traditional or Roth accounts. However, there are two advantages which may make traditional contributions more attractive. If you cannot afford to contribute $2,000 to a Roth account, then you can contribute more to a traditional account for the same out-of-pocket cost to get a larger match. In addition, the credit is based on your adjusted gross income; contributions to a Traditional IRA or 401(k) reduce your adjusted gross income and may make you eligible for the credit, or for a larger credit. While qualifying for the Saver's credit, Traditional or Roth can be decided upon using the following analysis.

$$ \begin{align} mtr_{T} &= \text{marginal tax rate for the traditional contribution} \\ mtr_{R} &= \text{marginal tax rate for the Roth contribution} \\ NI &= \text{Net Income (gross pay minus all deductions and tax) before accounting for traditional or Roth contributions} \\ R &= \text{Roth contribution} \\ R_{sp} &= \text{spendable Roth amount in retirement} \\ T &= \text{traditional contribution} \\ T_{sp} &= \text{spendable traditional amount in retirement} \\ mwr_{T=R} &= \text{withdrawal marginal tax rate for the traditional account that makes traditional and Roth results equivalent} \\ \end{align} $$

For a fair comparison, the two take home pays must be equal: $$Take\ home\ pay\ traditional\ = NI - T * (1 - mtr_T)$$ $$Take\ home\ pay\ Roth\ = NI - R * (1 - mtr_R)$$

Equating them and solving for R or T we get:

$$R = T * (1 - mtr_T) / (1 - mtr_R)$$ $$T = R * (1 - mtr_R) / (1 - mtr_T)$$

If $$mr_R=0$$, then those reduce to the familiar equations for equivalent Roth and traditional contributions.

The equations for spendable amounts are:

$$R_{sp} = R \cdot (1+i)^n = T * (1 - mr_T) / (1 - mr_R) * (1+i)^n$$ $$T_{sp} = T \cdot (1+i)^n * (1 - mtr_{T=R})$$

Equating those and solving for $$mwr_{T=R}$$, we get:

$$mwr_{T=R} = (mtr_T - mtr_R) / (1 - mtr_R)$$

For example, take a single filer with $30K gross income. For that person, up to a $2,000 contribution, $$mtr_T = 22%$$ and $$mtr_R = 10%$$.

For a $2,000 traditional contribution, the equivalent Roth contribution is $$R = $2,000 \cdot (1 - 22%) / (1 - 10%) = $1733$$.

The withdrawal marginal tax rate for equivalent results is $$mwr_{T=R} = (22% - 10%) / (1 - 10%) = 13.3%$$.

If one expects the actual withdrawal marginal tax rate will be less than 13.3%, traditional is better. If more than 13.3%, Roth is better.

Real-world example
The methods described earlier in this article assume that one's marginal tax rate vs. contribution curve is either flat or decreasing, and one's marginal tax rate vs. withdrawal curve is flat or increasing. This behavior would be typical of a simple progressive tax system. The US tax code, however, is not simple. Some credits, e.g., the Earned Income Tax Credit (EITC) and the Saver's credit, may apply only after a certain amount of low benefit contributions. Similarly, the Taxation of Social Security benefits may cause high rates on some portion of withdrawals, but past that portion the rates decrease.

Consider a couple with two children earning $54,000 per year gross income. Their marginal tax rate curve looks as follows. The plot has negative values because the tax goes down as the 401(k) contribution goes up. The rest of this example follows the convention of ignoring the negative sign and refers to the rate at which tax was avoided when using "tax rate."



Their marginal tax rate goes through regions of 22%, 43%, 33%, 31%, and 21%, and there is a $200 spike due to a change in the saver's credit tier from 10% to 20%.
 * 22%: 12% bracket plus 10% saver's credit
 * 43%: 12% bracket plus 10% saver's credit plus 21% Earned Income Tax Credit phase-in
 * 33%: 12% bracket plus 21% Earned Income Tax Credit phase-in (saver's credit maximum contribution reached for this example)
 * 31%: 10% bracket plus 21% Earned Income Tax Credit phase-in
 * 21%: 0% bracket plus 21% Earned Income Tax Credit phase-in

Method
In order to capture the effect of the various peaks, valleys, and spikes, remember the operative definition of marginal tax rate: [total additional tax] / [total additional contribution]. In the chart above, the "Cumulative" curve shows that calculation for the given starting point. For example, even though the marginal tax rate is 43% for contributions between $1,500 and $2,000, this couple would have to contribute $1,500 at only 22% in order to achieve that benefit. A $2,000 401(k) contribution would result in a tax decrease of $543.83, for a marginal tax rate of about 27% ($543.83 / $2,000). If the marginal tax rate on withdrawals is fixed, a simple method to optimize contributions is as follows:


 * 1) Starting at a traditional contribution of $0, calculate the marginal tax rates ([total additional tax saved] / [total additional contribution]) for all contributions between the starting point and the maximum contribution (limited by either IRS rules, or how much you can afford to save).
 * 2) Find the maximum marginal rate and the corresponding contribution
 * 3) If the maximum marginal rate is greater than your predicted marginal tax rate at withdrawals, make that traditional contribution.  Then return to Step #1 with the starting $0 reset to the traditional contributions so far. If the contribution marginal tax rate becomes lower than the expected withdrawal tax rate, contribute remaining retirement savings to Roth accounts.

It may be helpful to use charts such as the example given here to understand these situations. One can download the Personal finance toolbox Excel spreadsheet and use it for a wide variety of tax situations. Simply eyeballing the chart, it appears that somewhere between $13K and $14K would be the best traditional contribution. See below for more exact numbers.

Analysis
The married one-earner couple described above predict a 22% marginal tax rate in retirement. They can afford to save $10,000 after taxes to retirement accounts. How much should they contribute to traditional and Roth accounts?


 * Starting from $0 contribution, their maximum marginal savings rate is at a 401k contribution of $12,500, just enough to reach the 20% Saver's credit tier. This contribution results in a total tax savings of $4,169, for an incremental savings rate of ~33.35%. This rate is higher than the expected marginal tax rate on withdrawals of 22%, and the after-tax cost of $8,331 ($12,500 - $4,169) is less than the maximum, so contribute $12,500 to traditional accounts and try another iteration.
 * Starting from $12,500 contribution, their maximum incremental savings rate is at an incremental contribution of $1,100, resulting in an incremental tax savings of $342, for an incremental savings rate of ~31.1% ($342 / $1,100). This rate is still higher than the withdrawal tax rate, and the total after-tax cost is $9,089 ($1,100 - $342 + $8,331), so contribute an additional $1,100 to traditional accounts and try another iteration.
 * The marginal rate for all traditional contributions beyond $13,600, up to the $19,000 IRS limit, is ~21.06%. This is less than the marginal tax rate on withdrawals, so contribute no additional traditional money. Contribute the remaining $911 ($10,000 - $9,089) to Roth accounts. To maximize the saver's credit, the $911 should be contributed by the non-earning spouse. If both spouses are eligible for a 401k, having each contribute at least $2,000 will maximize the saver's credit, and then who contributes to the Roth doesn't matter.

These steps can be summarized in the following table:

The optimal retirement contributions for this couple are $13,600 to traditional accounts and $911 to Roth.

Additional examples may be found in User:FiveK/Traditional versus Roth examples - Bogleheads

Direct calculation method
For situations where both the marginal savings rate and marginal tax rate at withdrawal are irregularly shaped (perhaps due to taxation of Social Security benefits), direct calculation of future after-tax value in retirement is best. One possible method could be as follows:


 * 1) For every possible Traditional contribution, calculate the maximum amount of Roth and taxable contributions that can be made while still having enough spending money to cover expenses.
 * 2) For each case, calculate the future value (using "=FV" in Excel, or similar) of the Traditional, Roth, and taxable accounts at retirement.
 * 3) Calculate the total taxes due in retirement, and the after-tax value of investment withdrawals. The set of contributions with the highest after-tax value is best.
 * 4) The analysis should be repeated every year.