Countless investors have successfully built huge nest eggs by finding great stocks and holding onto them for the long term. But if you want to hang onto as much of your wealth as you can, there's something you should make sure you don't do.

Yes, doing nothing may be exactly the right move when the time comes for you to start spending down your assets. Rather than cashing in the long-held winning stocks in your portfolio, you may find that by holding onto those winners, you can legally avoid paying huge amounts of money to the folks you'd least want to have it -- the IRS.

There's a lot at stake
If you've invested for any length of time, you're probably well aware of the taxes that apply to your investment gains. Short-term gains -- profits you earn from investments you hold for one year or less -- are subject to income tax at your ordinary income tax rate. But if you hold onto your stocks for more than a year, then you get to pay tax at a lower rate -- a maximum of 15%. In fact, lower-income taxpayers in the 10% and 15% tax brackets pay nothing at all on their capital gains.

That sounds like a good deal -- and it is, in comparison to the way things were after the 1986 Tax Reform Act, when capital gains were taxed at exactly the same rate as any other type of income. But if you've held onto your stocks for a long time and seen them climb through the roof, then even a 15% haircut means a lot of money out of your pocket. Just consider how much income tax you'd pay from holding these stocks over the long term:

Stock

Length of
Time Held

$10,000 Investment
Becomes ...

Capital-Gains Tax
at 15% Rate

Intel (NASDAQ:INTC)

20 years

$215,116

$30,767

Dell (NASDAQ:DELL)

20 years

$1,593,750

$237,563

IBM (NYSE:IBM)

30 years

$137,783

$19,167

Pfizer (NYSE:PFE)

20 years

$101,141

$13,671

Oracle (NASDAQ:ORCL)

20 years

$527,805

$77,671

General Mills (NYSE:GIS)

20 years

$87,747

$11,662

Amgen (NASDAQ:AMGN)

20 years

$615,474

$90,821

Source: Yahoo! Finance.

As you can see, if you were fortunate to have had your money invested in those stocks over the decades and decided to cash them all in to finance your retirement, you'd pay more than $480,000 in income taxes.

Don't share your gains
Almost half a million bucks to the IRS? That's not where you want your retirement money going. But is there anything you can do about it, or are those taxes just inevitable?

Well, the answer is that it depends. If you don't need that money for your own living expenses, then that potential tax liability may disappear. After your death, any assets you own get what's called a stepped-up basis. That means that if your heirs inherit the shares from you and then sell them immediately, they don't have to pay any capital gains tax at all.

You don't typically run into that kind of a tax break. For instance, on traditional IRAs, your heirs do have to pay income tax on remaining funds as they make mandatory withdrawals of assets from their inherited accounts. But not with stocks held in regular taxable accounts.

Obviously, that creates a big opportunity. If you can just hang onto those shares until your death, then neither you nor your heirs will ever have to pay that $480,000 in taxes. That's an awfully big incentive to stand pat on your winning stocks.

Planning for lower taxes
Of course, if you need the money from those stocks to finance your own lifestyle, then your own needs should generally trump those tax considerations. But you may want to rethink the order in which you decide to draw down your savings. Although paying tax prematurely by withdrawing from retirement accounts often costs more in the short run, you may create long-term savings by going ahead and paying tax that's completely unavoidable in favor of preserving the stepped-up basis tax break.

It's rare that you can earn big tax savings from doing absolutely nothing. Yet that's exactly what stepped-up basis can do for you and your loved ones. By planning for the future, you can cut the IRS out and leave more for those who deserve your money more.

For more on making the most of your retirement: