Retirement planning can be tough. It is hard enough to save for a comfortable retirement during your working years. Once you actually retire, managing your withdrawals and your spending can be complicated. One important and complex area in both parts of your life is managing the process in the most tax-efficient manner.

If you have portions of your nest egg in various types of accounts ranging from tax-deferred to tax-free (a Roth) or taxable, it can be a challenge to decide which accounts to tap and in what order.

Required minimum distributions (RMDs) also come into play after age 70½. Here are some tips for those saving for retirement, for retirees and for financial advisors advising them. (For related reading, see: Should Retirees Reinvest Their Dividends?)

Fatten Up Your 401(k) 

Contributing to a traditional 401(k) account is a great way to reduce your current tax liability while saving for retirement. Beyond that your investments grow tax-deferred until you withdraw them down the road.

For most workers, contributing as much as possible to a 401(k) plan or a similar defined contribution plan like a 403(b) is a great way to save for retirement. The maximum salary deferral for 2016 and 2017 is $18,000 with an additional catch-up for those age 50 or over of $6,000, bringing the total maximum to $24,000. Add any company matching or profit-sharing contributions in and this is a significant tax-deferred retirement savings vehicle and a great way to accumulate wealth for retirement.

The flip side is that with a traditional 401(k) account, taxes – at your highest marginal rate – will be due when you withdraw the money. With a few exceptions, a penalty in addition to the tax will be due if you take a withdrawal prior to age 59½. The assumption behind the 401(k) and similar plans is that you will be in a lower tax bracket in retirement. As people live longer and the tax laws change, though, we are finding this is not always the case. This should be a planning consideration for many investors. (For more, see: Are 401(k) Withdrawals Considered Income?)

Use IRAs

Money invested in an individual retirement account (IRA) grows tax-deferred until withdrawn. Contributions to a traditional IRA may be made on a pre-tax basis for some, but if you are covered by a retirement plan at work, the income limitations are pretty low.

The real use for an IRA for many is the ability to roll over a 401(k) plan from an employer when they leave a job. Considering that many of us will work at several employers over the course of our careers, an IRA can be a great place to consolidate retirement accounts and manage them on a tax-deferred basis until retirement.

Considerations with a Roth IRA

A Roth account, whether an IRA or within a 401(k), can help retirement savers diversify their tax situation when it comes time to withdraw money in retirement. Contributions to a Roth while working will be made with after-tax dollars so there are no current tax savings. However, Roth accounts grow tax-free and if managed correctly, all withdrawals are made tax-free.

This can have a number of advantages. Besides the obvious benefit of being able to withdraw your money tax-free after age 59½ and – assuming that you’ve had a Roth for at least five years – Roth IRAs are not subject to RMDs, the required minimum distributions  that have to begin when you reach 70½. That's a big tax savings for retirees who do not need the income and who want to minimize their tax hit. (For more, see: Why Boomer Retirements Will Be Vastly Different Than What They Planned For.) For money in a Roth IRA, your heirs will need to take required distributions, but they will not incur a tax liability if all conditions have been met.

It is generally a good idea to roll a Roth 401(k) account into a Roth IRA rather than leaving it with your former employer in order to avoid the need to take required distributions at age 70½ if that is a consideration for you.

Those in or nearing retirement might consider converting some or all of their traditional IRA dollars to a Roth in order to reduce the impact of RMDs when they reach 70½ if they don’t need the money. Retirees younger than that should look at their income each year and in conjunction with their financial advisor, decide if they have room in their current tax bracket to take some additional income from the conversion for that year. For more, see Why Age 70 Is Pivotal for Retirement Planning.

Open an HSA Account

If you have one available to you while you are working, think about opening an HSA account  if you have a high-deductible health insurance plan.  In 2016, individuals can contribute up to $3,350 per year; it rises to $3,400 in 2017.  Families can contribute $6,750 in both years. If you're age 55 or older,  you can put in an additional $1,000.

The funds in an HSA can grow tax free. The real opportunity here for retirement savers is for those who can afford to pay out-of-pocket medical expenses from other sources while they are working and let the amounts in the HSA accumulate until retirement to cover medical costs that Fidelity now projects at $245,000 for a retiree couple where both spouses are age 65. (For more, see: How to Use Your HSA for Retirement.) Withdrawals to cover qualified medical expenses are tax-free.

Choose the Specific Share Method for Cost Basis

For investments held in taxable accounts, it is important to choose the specific share identification method of determining your cost basis when you have purchased multiple lots of a holding. This will allow you to maximize strategies such as tax-loss harvesting and to best match capital gains and losses. Tax-efficiency in your taxable holdings can help ensure that more is left for your retirement.

Financial advisors can help clients to determine cost basis and advise them on this method of doing so.

Manage Capital Gains

In years when your taxable investments are throwing off large distributions – to the extent that a portion of them are capital gains – you might utilize tax-loss harvesting to offset the impact of some of these gains.

As always, executing this strategy should only be done if it fits with your overall investment strategy and not simply as a tax-saving measure. That said, tax management can be a solid tactic in helping the taxable portion of your retirement savings portfolio grow.

The Bottom Line

Saving for retirement is mostly about the amount that is saved. But at all phases of saving for retirement there are things investors can do to help mitigate taxes that can add to the amount ultimately available in retirement. This is an area where knowledgeable and experienced financial advisors can add real value to your retirement planning. (For more, see: 5 Investments You Can't Hold in an IRA.)