If you've spent nearly your entire adult life working, retirement may seem like it can't come soon enough. And the idea of spending several decades in retirement probably sounds like a dream.

To your wallet, though, a long retirement may be more of a nightmare.

A third of today's 65-year-olds can expect to live past age 90, according to the Social Security Administration, and one in seven will make it past age 95. If you retire at age 65, that means there's a good chance you'll be spending 25 to 30 years in retirement. Unless you have a rock-solid nest egg, your savings likely won't last that long.

The average American is expected to run out of savings at some point during retirement, says a new report from the World Economic Forum. Most U.S. retirees will likely outlive their savings by around eight to 10 years, according to the study, but that's assuming a life expectancy of age 85. Retirees who live longer than that could potentially spend even more time in retirement with no savings.

If you run out of money with years (or even decades) still to spend in retirement, your golden years likely won't be as enjoyable as you'd hoped. The key, then, is to do your research long before you retire to ensure your savings are on track to last the rest of your life.

How much should you save for retirement?

There's no easy answer for how much you should have saved by the time you retire, since everyone's retirement number will be different. Some people will only spend a decade or so in retirement, so they'll need less in savings. Others could live until they're 110 years old and may need a couple million dollars to last the rest of their life.

To get a sense of how much you'll need in savings, take an honest look at your life expectancy. Of course, nobody can predict exactly how long they'll live. But if you have health issues or other reason to believe your retirement years won't last long, that will help you better gauge how much you'll need to save. On the other side of the coin, if everyone in your family has lived until age 100, it's probably a good idea to prepare for a very long retirement.

The type of lifestyle you expect to live in retirement also plays an important role. Someone who wants to spend their golden years traveling constantly or learning expensive new hobbies will likely spend more money than someone who prefers to enjoy most of their time relaxing around the house and catching up on their reading.

Once you have an idea of how many years you expect retirement to last and how much you predict you'll spend each year in retirement, you can plug your information into a retirement calculator to get an estimate of how much you should save. Because no calculator can be 100% accurate, it's a good idea to try out a few different calculators to get a range of answers. When presented with several different retirement numbers, it's smart to aim high and save more than you think you'll need.

How Social Security benefits factor into retirement

If you run out of savings in retirement, you'll still have Social Security benefits to fall back on. But Social Security isn't the strongest safety net, and you may not be able to survive on your benefits alone. The average beneficiary receives around $1,400 per month from Social Security, which may not be enough to make ends meet even when you're relatively young and healthy -- and it could be even more problematic as you age.

As you get older, you'll inevitably face more health issues. Healthcare isn't cheap, either, and the average retiree spends around $4,300 per year on out-of-pocket costs, according to the Center for Retirement Research at Boston College. That number also doesn't include long-term care, which can be incredibly costly. The average semi-private room in a nursing home costs nearly $7,000 per month, according to the U.S. Department of Health and Human Services, and 70% of today's 65-year-olds can expect to need long-term care at some point in their lives.

If your savings run dry a decade or two into retirement and then you're hit with steep healthcare costs, Social Security alone probably won't cover all of your expenses. There are ways to increase your Social Security benefits to make it a little easier to squeeze every dollar out of your monthly checks, but it's still smart to save as much as you can on your own so you're not entirely dependent on your benefits to pay for all of your expenses.

Saving for retirement is a big enough challenge on its own, but as Americans are living longer -- needing their money to go further than ever before -- it's becoming even more difficult to save enough to last the rest of your life. If you can estimate how much you'll need to save and create a retirement plan you can stick to, it will help ensure your money lasts as long as possible.