Exchange-traded funds have never been more popular. With many ETFs, their ease of trading and simple index-tracking philosophies make them both transparent and inexpensive.

One other often-cited benefit of ETFs is the idea that they're tax-efficient. Compared to actively managed mutual funds, which often give their investors a much-hated tax bite from year-end capital gains distributions, ETFs usually help their shareholders minimize the impact of taxes on their overall returns. But sometimes, even ETFs fail in this -- and this year, some ETF investors will get an unexpected surprise from the funds they own.

A taxing proposition
Both mutual funds and ETFs act as what's known as pass-through entities, meaning that any taxable income that they generate ends up getting passed on to their shareholders. The benefit of that treatment is that the fund itself doesn't have to pay any taxes. But when funds collect dividend income or sell securities at a gain, they have to pay the resulting income to you in the form of a fund distribution that usually comes near the end of the year.

For long-term investors, the worst part of year-end distributions is that you have to pay taxes on them even if you choose to reinvest them to buy additional shares of the fund. Although many have seen that as colossally unfair and lobbied to have Congress change the law to let fund investors defer taxes until they actually sell the shares, lawmakers still haven't gotten around to taking action.

Where the taxes are
On dividends, there's typically little that a fund can do to avoid taxes, and so both mutual funds and ETFs routinely make dividend distributions -- often throughout the course of the year. But with capital gains, most ETFs can be more tax efficient than mutual funds for a simple reason: Unless the indexes they track change, they don't replace one stock with another, and so they avoid having to liquidate big positions with massive gains. Moreover, because of the mechanics of how institutions create and redeem ETF shares, fund companies have a lot more flexibility to manage their tax liability than some mutual funds do.

Sometimes, though, volatile conditions make it impossible for ETFs to avoid capital gains distributions. In 2008, for instance, several bear-market leveraged ETFs, including ProShares UltraShort Basic Materials (NYSE: SMN), made huge taxable distributions to shareholders -- payouts that wiped out more than a third of the ETF's assets. Several other ETFs, including ProShares UltraShort Real Estate (NYSE: SRS) and ProShares UltraShort Dow 30 (NYSE: DXD), made substantial though smaller capital gains distributions.

This year, the stock market hasn't produced huge gains or losses, and so the situation is more favorable. ProShares, for instance, announced that none of its funds plan to make distributions of capital gains this year. But bonds have seen huge gains, and so several bond ETFs have announced capital gains distributions. The popular iShares Barclays Aggregate Bond ETF (NYSE: AGG) is one of the largest, but Vanguard has announced that 10 of its ETFs will have capital gains to distribute, including Vanguard Extended Duration Treasury (NYSE: EDV), Vanguard Short-Term Bond (NYSE: BSV), and its benchmark Vanguard Total Bond Market (NYSE: BND).

Don't panic
Of course, the whole reason ETFs generate capital gains is because they've earned gains. So if you've held shares of the ETFs all year, then you've already benefited from the big jumps in their value -- and paying a little bit of that back in tax isn't quite as painful. Unlike the bear market funds in 2008, most of these distributions amount to at most a few percent of their net asset values.

The problem, though, is that if you buy new shares of these ETFs right before they make these distributions, you'll suffer an immediate tax hit -- even though you didn't benefit from those gains. To avoid the problem, you need to look up when the ETFs plan to make those distributions, and then just wait until after the distribution to buy new shares.

ETFs aren't perfect, but they're still a lot more tax-efficient than many alternatives. As long as you're prepared for the occasional hiccups, you should be happy with your ETF portfolio.

Read more about great funds in The Motley Fool's latest free special report on ETFs. You'll learn about three ETFs that have real potential in the coming years -- but only if you act soon.