(Money Magazine) -- We'll go out on a limb and assume you've heard the rumor that Social Security and Medicare are headed for trouble.

You've seen alarming stats thrown around and maybe wondered what to make of them. (For example, the two programs are said to have a $43 trillion deficit payable over 75 years. Is that a lot? And if it's as big as it sounds, how is the government still running?)

Perhaps you've even slogged through one of the reform plans that politicians, academics and retired CEOs are always dreaming up. But what you really want to know is more basic: How am I supposed to plan for this?

Here's where politics meets your portfolio. And as tricky as it is to guess the direction of stocks, it's even harder to predict the long-run electoral fortunes of Republicans and Democrats or the compromises legislators will hammer out. That said, there are some things you can expect when you get to retirement:

You'll have a significant Social Security benefit, especially if you're a boomer. The system's problems are quite fixable.

Medicare, on the other hand, is headed for crisis. A total meltdown. And soon. For the health insurance program to survive, it will have to make huge changes, and you must start preparing for them.

Both programs will be fixed with a combination of benefit cuts and higher taxes. Many of the higher taxes will be levied on your paycheck. But it's also possible that higher taxes on income and investments will hit you in retirement.

Well-off retirees - and by that we mean people with pensions and biggish IRAs, not just former hedge fund managers - will increasingly pay stealth taxes on their benefits. And we're not talking about some far-off proposal here. This one's already a done deal.

No matter what happens, Social Security and Medicare (in some form) are still going to play a major role in your retirement. So even if your last day of work is 10, 20 or 30 years off, you need to have a basic grasp of the challenges these systems face and the price you'll be asked to pay to keep them alive and kicking. Getting ready is partly a matter of how much you save - but as you'll see, it also matters where you save it.

Social Security: How much trouble is it in?

Established back in 1935, when the U.S. was mired in the Great Depression, the Social Security program now replaces just under 40% of the average retiree's pre-retirement earnings.

Even for higher-paid workers, it represents a significant source of income: For people who currently earn $100,000 or more on the job, Social Security is expected to replace about 25% of their incomes, on average, in retirement. So it had better be there.

But thanks largely to the baby boom, there's a funding gap in the not-too-distant future. Social Security is a "pay as you go" retirement system - that is, the Social Security taxes that get deducted from your paycheck today are used to pay out benefits to today's retirees.

Right now the Social Security system is taking in more money in tax revenue than it is paying out in benefits, with the surplus being entered into the government's books as the system's "trust fund."

But with so many boomers headed into retirement, that situation is likely to reverse sometime around 2017. Benefits will exceed revenue, and Social Security will have to draw on that trust fund.

By 2041 the trust fund will be tapped out too. At that point Social Security payroll taxes will be enough to fund only about 78% of promised benefits. The oldest boomers will be 95 that year. The youngest will be 77, with perhaps another decade or two of retirement to fund.

The price you'll pay

As bad as this all sounds, Social Security could be brought into balance without extreme pain. None of the reform proposals that have gotten the slightest political traction, including President George W. Bush's effort, would touch benefits for anyone over 55 when enacted. Retirement ages could be increased, but with life expectancy rising, that may not be so terrible, at least in a white-collar job.

One well-regarded proposal, by economists Peter Diamond and Peter Orszag, would reduce promised benefits gradually, with today's twentysomethings losing just 8.6% of their benefit. Payroll taxes would rise from 6.2% to 7.1% by 2055. That's hardly earth-shattering. And once you were retired, of course, you'd be off the hook for those higher payroll taxes.

But you may not be off the hook for all Social Security taxes. You see, Social Security has been in bigger financial trouble before. And the last time it went in for repair, lawmakers put in place some obscure new taxes on affluent retirees to shore up the system. Those taxes are automatically going to snag more and more people.

To understand these stealth taxes, you have to look back to the early 1980s. Ronald Reagan appointed a commission, chaired by future Federal Reserve chief Alan Greenspan, to come up with ways to keep Social Security solvent. The commission's recommendation: Make the wealthiest retirees pay partial taxes on their Social Security benefits. In 1984 that recommendation became law.

This tax is confusing, to put it mildly. When half of your Social Security benefit, plus all your other income, exceeds $25,000, or $32,000 as a married couple, some of your Social Security benefit starts to count as taxable income. That "other" income includes withdrawals from regular 401(k) accounts and traditional IRAs, as well as payments from a traditional pension plan and any employment income.

It also includes dividends, interest and capital gains on investments - even the interest on tax-free municipal bonds is thrown into the calculation. For each dollar of income over that $25,000 threshold, 50� of Social Security counts as taxable income until 50% of your benefit is subject to taxes. (Told you it was confusing.)

There's more. In 1994 the Clinton administration upped the ante. Now when half of your Social Security plus other income tops $34,000, or $44,000 for a couple, you have to add 85� of your Social Security to taxable income for each additional dollar of earnings.

And the pain doesn't stop until 85% of your benefits have been tossed into your taxable income. At first these rules didn't affect a lot of people. But here's the catch: Like the dreaded alternative minimum tax, those crucial income thresholds weren't indexed to inflation.

As a result, a third of all retirees are now paying federal income tax on their Social Security benefits. In 10 years, 43% of retirees will be subject to at least some of this tax.

For those caught in it, the tax makes the shelter of 401(k)s and traditional IRAs less valuable than you might have assumed. Let's say you get $24,000 a year from Social Security and draw $22,000 from a pension. That's enough to start moving you into the 85% zone.

Every additional dollar you withdraw or earn will have you reporting an additional $1.85 in taxable income. Hit the 25% tax bracket and that adds up to a 46� levy on what surely must have seemed like, and spent like, only a buck of income. Presto: You have an effective marginal tax rate of 46%. Unless, that is, you get your income from somewhere else - but more on that in a moment.

This tax is sticking around, says Andrew Biggs, a Social Security expert at the American Enterprise Institute. "If the government dropped the tax, they'd have to come up with something to replace it, which they don't have," he says.

Send feedback to Money Magazine