We research all brands listed and may earn a fee from our partners. Research and financial considerations may influence how brands are displayed. Not all brands are included. Learn more.

Chad Baker—Getty Images

Is a traditional IRA or a Roth IRA better for you? That's a question that retirement savers and financial pros perennially noodle over.

The accounts' tax treatments are the mirror images of each other: With a traditional IRA, if you qualify for a deduction, you get a tax break on your contributions today and owe tax on the dollars you pull out down the road. With the Roth, you forego the tax benefit now to collect in the form of tax-free income in later life.

A recent NerdWallet study concluded that most people are likely to come away with more money after taxes in retirement if they contribute the maximum $5,500 a year to a Roth IRA rather than putting that same amount into a traditional IRA. But before you start rushing to a Roth, you need to understand why even though Roths do come out ahead in many cases, they can also fall behind in many others.

Let's start with the part of the study where NerdWallet says "the Roth IRA really outshines the traditional IRA" and shows the Roth coming out ahead in a number of cases by an extra $184,000 in after-tax savings after 30 years. To arrive at that figure, NerdWallet assumes the maximum allowable annual contribution of $5,500 a year is made to both types of IRA for 30 years. It also assumes those contributions earn an investment return of 6% a year and that the account owner ends up paying a tax rate of 40% in retirement.

Do the arithmetic, and you'll find that after 30 years both the traditional IRA and the Roth account would have a balance of just under $461,000. But the traditional IRA would also have a tax liability of about $184,000 (40% of $461,000), thus giving the Roth that impressive $184,000 edge.

Tilting the Playing Field

This analysis gets to that huge advantage by tilting the playing field in the Roth IRA's favor in two ways. One is that lofty tax rate, which takes such a big bite out of the dollars accumulated in the traditional IRA.

Second, and more important is that even though the contributions to the two accounts are the same, they aren't really equal. Why is that? Well, assuming you qualify for the traditional IRA's tax deduction, you need only $5,500 of pay before taxes to make that maximum contribution. With the Roth, contributions are made in after-tax dollars. Which means you have to part with more than $5,500 in pretax dollars to make a $5,500 Roth contribution.

If you're in, say, the 25% tax bracket at the time you make the Roth contribution, you have to give up $7,333 before taxes to make an after-tax contribution of $5,500 ($7,333 minus tax of $1,833 at a 25% rate leaves $5,500 after taxes). If you're in the 35% bracket, you've got to part with even more—$8,462 before taxes—to make the $5,500 contribution.

In short, in this scenario you're effectively contributing less of your pay to the traditional IRA than to the Roth. So it's hardly a surprise that the Roth IRA whips the traditional IRA every time.

The math is very different if you assume that the amount invested in the traditional IRA and Roth IRA are equivalent after taking taxes into account—for example, $3,000 after-tax in the Roth and the pretax equivalent at a 25% tax rate of $4,000 in the traditional IRA. In that case, after 30 years the two accounts would have the same after-tax balance, assuming tax rates don't change.

A More Complete Comparison

In an another analysis in its study, NerdWallet makes what I consider a more accurate comparison of Roth and traditional IRAs when making the maximum contribution to a Roth. They start with the same amount of pretax dollars for both accounts. Of course, if you're investing the maximum $5,500 in a Roth IRA, it's impossible to invest the pretax equivalent of that amount in a traditional IRA, as you would exceed the IRA annual contribution limit. So to put the two options on more equal footing, you have to figure that the traditional-IRA saver is also putting additional dollars into a separate investment account that is subject to taxes.

Remember that for a person in the 25% bracket, the pretax equivalent of a $5,500 Roth contribution is $7,333, or $1,833 above the $5,500 maximum. To keep the comparison apples to apples, this analysis assumes that after investing $5,500 in a traditional IRA, that person would also invest $1,375 in a taxable side account. That $1,375 represents the $1,833 overage, reduced by $458 in tax at the 25% rate.

When the NerdWallet study crunches the numbers this way, the Roth IRA still wins in many cases. But its margin of victory tends to be smaller and, more importantly, in many other scenarios the traditional IRA plus taxable account comes out ahead. In other words, when you make a fairer comparison, the Roth IRA isn't the slam dunk it seemed to be.

In weighing a Roth vs. traditional IRA, one key thing to keep in mind is the importance of taxes and tax rates. Generally, if you end up in a higher tax bracket in retirement than when you made the contribution, you'll have more after-tax dollars with the Roth IRA. You'll have paid tax at a lower rate when you put your money into the account and avoided the higher tax rate at withdrawal, since qualified Roth withdrawals aren't taxed. Conversely, if you drop into a lower tax rate at retirement, that favors a traditional IRA, as you'll have avoided taxes on your traditional IRA contribution when your tax rate was higher and you'll have paid taxes at a lower rate at withdrawal.

But even in cases where someone drops to a lower tax rate in retirement, it's still possible for the Roth to end up producing a larger after-tax balance than the traditional IRA plus taxable account. That's not because of some Roth magic. It's because of taxes on investment gains in the taxable account.

While investment gains inside an IRA compound without the drag of taxes, you must pay taxes on gains in the side account. Which means the money invested there—the $1,375 in the example above—will grow at a lower after-tax rate than money in the Roth IRA (assuming the same rate of return before taxes). And that difference in returns—call it "tax drag" in the taxable account—gives the Roth IRA a bit of an edge over the combination of a traditional IRA and a taxable account.

So Many Variables

The question is whether that edge is big enough for the Roth IRA still to generate a larger balance even if you slip into a lower tax rate in retirement. The answer depends on a number of factors, including how much your tax rate drops and how efficiently you invest to minimize the tax on gains in your taxable account.

Opinions can vary about how best to compare contributing to a Roth IRA vs a traditional one. Jonathan Todd, a co-author of the NerdWallet study, allows that assuming the maximum contribution of $5,500 in both the Roth IRA and traditional IRA without also investing the traditional IRA's tax savings effectively amounts to devoting more of your income to the Roth. But he also notes that "most people don't take the extra step and invest the tax savings."

More from RealDealRetirement.com: What Size Nest Egg Do You Need For Your Retirement?

Fair enough. But even if you don't invest the tax savings, that money doesn't disappear. It still has economic value and can improve a household's wellbeing. And, indeed, the study acknowledges this, noting that "those tax savings can be a valuable addition to an emergency fund, or they can help pay down debt or loosen monthly cash flow." I couldn't agree more. In fact, I'd add that those savings could be used in plenty of other of productive ways as well, including paying household bills, accumulating a down payment for a home, investing in a child's education or simply improving a family's living standard. Which is why I think any analysis that essentially ignores the value of those savings—even if it shows the Roth IRA coming on top in every scenario often by very impressive margins—isn't very meaningful.

Ultimately, what I take away from this study is that for many, if not most, people, it's difficult to really know whether a Roth IRA or traditional IRA will end up being the superior choice. With uncertainty both about your future income and future tax rules, it's impossible to know the tax rate you'll owe when you withdraw money from a traditional IRA many years down the road. Which is why I think it's a good idea for most people to consider hedging their bets by having some money in both a traditional IRA and/or 401(k) as well as in a Roth IRA and/or Roth 401(k) account. That will allow you to diversify your tax exposure, so to speak, rather than making an all-or-nothing bet with all of your retirement savings on a particular tax scenario playing out. Having the ability to draw money from both types of accounts can also give you more leeway in managing withdrawals and possibly lowering your tax bill in retirement.

Bottom line: The prospect of a big tax-free account balance in retirement may make a Roth IRA seem like the obvious choice. But that doesn't mean it's necessarily the right one.

Walter Updegrave is the editor of RealDealRetirement.com. If you have a question on retirement or investing that you would like Walter to answer online, send it to him at walter@realdealretirement.com. Follow Walter on Twitter @RealDealRetire.