Social Security and Medicare are not financially viable over the long run. In fact, we have fewer than two decades before both programs are out of money. However, the good news is that there's still time to fix the problem, and if Congress acts soon, the solution could be less painful on your wallet than you might think.

The 2017 payroll tax

The payroll tax in the United States has two parts – one that covers Social Security and another that helps fund Medicare.

Social Security card in money.

Image Source: Getty Images.

As of 2017, the Social Security portion of the payroll tax is 6.2% of the first $127,200 of earned income, and nothing on earned income above that threshold. This is the rate that employees pay, and employers are required to match employees' payroll taxes, so the total Social Security tax rate is 12.4%.

For Medicare, the tax rate is 1.45%, significantly lower than Social Security, but there's no wage cap. In other words, you (and your employer) will pay the Medicare tax rate on every dollar of earned income. Additionally, highly paid employees pay an additional 0.9% Medicare tax on income above certain thresholds.

Self-employed individuals are considered to be both the employer and the employee for payroll tax purposes, and therefore must pay both parts of the tax.

The problem with Social Security and Medicare

I've written more thorough articles on the financial issues facing Social Security and Medicare, but here's the quick version:

The massive baby boomer generation is currently in the process of reaching retirement age, which means fewer people will be in the workforce paying into the programs, and more people will be retired and collecting benefits. For the time being, both Social Security and Medicare are running small surpluses, meaning that they're bringing in more than enough money to cover their costs. In addition, both programs have substantial sums of money in reserves -- $199.1 billion in the Medicare Hospital Insurance trust fund and $2.85 trillion in the Social Security trust fund.

However, as baby boomers continue to retire, these surpluses will give way to deficits, which will continue for the foreseeable future. In fact, these deficits are expected to eat away at the reserves fairly quickly. In 2034, Social Security's massive stockpile of reserves is forecast to be completely depleted. Medicare, which doesn't have nearly as much of a cushion, is expected to run out of reserves in 2029.

To be clear, these programs "running out of money" doesn't imply that benefits will just stop. Incoming payroll taxes would still be sufficient to cover 77% of Social Security's promised benefits and pay 88% of Medicare's Hospital Insurance costs.

We could fix both programs with a modest tax increase

According to the recently released trustees' reports, which project Social Security and Medicare's finances all the way out to 2091, the 75-year actuarial deficits for the programs are 2.83% of taxable payroll for Social Security and 0.64% of taxable payroll for Medicare.

Since only half of the payroll tax is paid by employees, this implies that we would need to raise the Social Security tax rate by 1.415% to 7.615% and the Medicare tax rate by 0.32% to 1.77%. Doing so would give the programs adequate revenue to last for at least another 75 years.

There are a few caveats, however. Most significant is that this assumes the tax increases are implemented right now. In reality, virtually all payroll tax increases that have been proposed would be phased in over a number of years. Doing so would require a higher overall increase to compensate.

It also assumes that Congress would pass such a tax increase. We currently have a Republican Senate and House of Representatives, not to mention a Republican administration in the White House that has promised to cut taxes. To put it mildly, while anything is possible, I'd say that a Social Security or Medicare tax increase would be a tough sell right now.

Other solutions that could fix the problem

Although a tax increase could certainly fix the problem, it's not the only way. There have been many realistic solutions proposed to fix Social Security and Medicare's funding issues, but all can be classified into two broad categories: tax increases and benefit cuts.

Surveys have shown that tax increases are by far the more popular, and more effective, way to go. A majority of all income groups, age groups, and political affiliations (even Republicans) agree that they wouldn't mind paying more Social Security tax if it meant that they won't have to worry about their benefits. Even so, changes such as a higher full retirement age for Social Security, higher eligibility age for Medicare, means-testing benefits, or other forms of cuts could potentially be included in any reform package.

Furthermore, in addition to across-the-board tax increases like the ones discussed here, there's also the option of raising or eliminating the taxable wage cap on Social Security, or increasing Medicare taxes on high earners only. Or, a combination of tax increases could be the way to go.

The bottom line is that there is still time to fix Social Security, and the tax increase that would be necessary would be rather modest. Whatever solution ends up being implemented -- tax increase, benefit cuts, or a combination -- the sooner it's done, the less dramatic it will need to be.