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.

Money is not a client of any investment adviser featured on this page. The information provided on this page is for educational purposes only and is not intended as investment advice. Money does not offer advisory services.

slice of pie being taken from mismatched pie
Bill Diodato

The end of the year is a natural time to rebalance—that is, reset your mix of stocks, bonds, and other assets to keep your portfolio from veering off course. For instance, if you had 60% in stocks, 30% in bonds, and 10% in commodities at the start of last year, you'd now have a 65% equity/30% fixed income/5% commodity mix. The simple solution: When your allocation changes by at least five percentage points, take some profits from your winners and replenish the losers.

Alas, things are never quite so easy. Chances are, you don't hold your investments in a single place. Your investments are probably scattered among 401(k)s, IRAs, and various brokerages. Fail to view that collection of accounts as a single overarching portfolio, and you may unnecessarily sell winners in your taxable account, "leading to an unfortunate side effect—a tax bill," says McLean, Va., financial planner Jason Williams.

To prevent that outcome, here are general rules to follow:

Rebalance Without Selling

If your allocation is only modestly off-kilter, you may not need to sell anything. "You can just buy more of the losers," says Pewaukee, Wis., financial planner Kevin Reardon.

Take a $200,000 portfolio that has 75% in stocks and 25% in bonds. Want to dial that back to 70%/30%? If you plan to save $10,000 next year in your IRA and 401(k), simply direct those new contributions to fixed-income funds, and you'll pretty much get to your goal.

Make sure you're buying the right asset in the right account.

For basic bonds, use your 401(k). If you haven't rebalanced in a few years, you'll have to restore your fixed-income stake. Over the past three years the S&P 500 has gained 15% a year, vs. 2% for bonds.

Why the 401(k)? "The concept, in a nutshell, is to save the most tax-inefficient assets for your tax-advantaged accounts," notes Vanguard strategist Joel Dickson. Bond interest is taxed as ordinary income, at a top rate of 43.4%, compared with a maximum of 23.8% for long-term capital gains and qualified stock dividends. So shelter your bonds.

Also, since 401(k)s have limited investment choices—most don't even offer short-term or high-yield bonds—use the plans to boost your plain-vanilla fixed-income exposure.

Don't worry if your 401(k) gets bond-heavy as a result. "What matters is the overall balance of stocks and bonds across your various portfolios," says Southfield, Mich., financial planner Melissa Joy.

For specialty bonds or commodities, use an IRA. Among the biggest losers over the past year have been global bonds (emerging-markets bond funds are down more than 8%) and commodities (down 25%). Both are relatively tax inefficient. For instance, gold funds that own physical metal are taxed at the "collectibles" rate, which can go as high as 31.8%.

Since both are small parts of your overall strategy, they're perfect for IRAs, where annual contributions are capped at $5,500 ($6,500 if you are 50 or older).

Save taxable accounts for tax-efficient assets. That means municipal bonds, which are usually tax-exempt, and index funds. Since they rarely sell, stock-index funds won't generate many unexpected tax bills, says Brookfield, Wis., adviser Andrew Houte.

If You Must Sell...

First sell shares in your tax-advantaged accounts, where you won't be hit with a tax bill (the typical rate is 15%). Realistically, though, that may not be enough to fully rebalance. In that case:

Pair losers with winners. Selling a winning stock in a brokerage account leads to a capital gains bill. Well, not necessarily. Say you do end up selling winning equities like health care stocks, which have doubled over the past five years. To lower taxes, sell a loser too—for instance, emerging-markets stock funds, which are down more than 20% over the past five years. The losses can be used to offset your gains dollar for dollar.

There is a catch. "Tax-loss harvesting" may alter your mix even as you're trying to rebalance. So reinvest the proceeds of the loss in a related investment. Under the IRS's "wash sales" rule, you aren't allowed to buy the same or a "substantially identical" security for a month to preserve the loss.

In this example, sell health care winners. Sell an actively managed emerging-markets fund. Then buy an emerging-markets index fund different enough to keep the tax break. The upshot: You rebalance without a huge tax bill, you maintain foreign exposure, and you reduce the cost of your portfolio.

Read next: How to Take Advantage of a Strong Dollar in 2016