Investing isn't just about finding stocks, bonds, and other investments that will rise in value. Successful investing also requires that you learn how to hang onto those hard-won gains. Unfortunately, two inevitable forces in finance -- taxes and inflation -- constantly work to erode the purchasing power of your portfolio, and you have to make sure that your rate of return is sufficient to overcome the downward pressure they exert on your savings. That typically requires taking on risk, but if you can produce enough growth in your assets, the true value of your portfolio should stay ahead of taxes and inflation.

How taxes and inflation affect you

It's pretty clear that having to pay taxes and suffering the impacts of inflation will hurt your portfolio. But the two factors cause problems in different ways.

With taxes, you can see the downward impact that paying tax has on your portfolio, because you'll typically have to pay those taxes year in and year out. The exception is when you invest in tax-preferred accounts like IRAs, in which you'll typically either avoid tax entirely or only have to pay tax when you take withdrawals from the account in retirement. Nevertheless, even with traditional IRAs, you can see how taxes hurt you, because you'll have to withdraw more than the amount of money you actually need in order to pay the taxes on the distributions you take from your retirement account.

Computer keyboard with a "tax" button

Image source: Getty Images.

With inflation, however, the downward impact is different. No one takes inflation charges out of your account, so you can think that you're doing just fine in terms of total return. Yet over time, inflation adds up. Over the past 28 years, for instance, price indexes have doubled. So if you started in 1989 with a portfolio worth $100,000, it would have had to grow to $200,000 just to retain its purchasing power. That means that keeping money in a low-interest bank account might seem like a safe way to preserve your capital, but over time, inflation eats away at its purchasing power slowly but surely.

An example of how this works

The way that inflation and taxes work in tandem to hurt your true rate of return on your investments can get complicated. Fortunately, calculators like the one below can make it easier to see examples of how these two factors interact.

Editor's note: The following language is provided by CalcXML, which built the calculator below.

* Calculator is for estimation purposes only, and is not financial planning or advice. As with any tool, it is only as accurate as the assumptions it makes and the data it has, and should not be relied on as a substitute for a financial advisor or a tax professional.

To see how this works, let's start with a basic example. Say that you invest $10,000 and earn an 8% pre-tax return. You're in the 25% tax bracket for federal purposes, and you also have to pay state income taxes of 5%. Inflation runs at a 3% rate over time. To keep things simple, we'll assume that you don't itemize deductions.

When you look at the results, you'll find that what at first seems like an 8% return is actually closer to 2.5% after taxes and inflation over a 10-year period. For instance, in the first year, your $10,000 will earn $800 in income. However, you'll owe $200 of that in federal taxes and another $40 in state taxes, cutting your ending value to $10,560. Then, the 3% inflation will reduce the purchasing power of that $10,560 to $10,252. That's roughly equivalent to the 2.5% real after-tax return that the calculator gave.

How you can fight back

If you don't want taxes and inflation to hit you hard, there are some things you can do. On the tax front, take full advantage of tax-favored accounts like IRAs, 401(k)s, and other workplace retirement plans, as well as health savings accounts, 529 college savings plans, and Coverdell Education Savings Accounts. All of these vehicles offer ways to fight back on the tax front and preserve more of your returns for yourself.

There's not much you can do about inflation, but you can invest with it in mind. Stocks do a better job than most bonds at responding favorably to inflation, although there are special inflation-indexed bonds that track changes in inflation indexes and can do a better job of helping you hedge against unexpected price spikes.

Taxes and inflation will have a negative impact on your investment returns, but you can take steps to minimize their effects. By looking for tax breaks, and investing to preserve the purchasing power of your portfolio, you'll go a lot further toward protecting your assets against these two financial forces.