The transition can be “pretty scary,” said Beth Gamel, a fee-only planner with Pillar Financial Advisors in Waltham. Not only do most people have to replace their regular paychecks with savings, they need to stretch those dollars over a retirement that may last 30 years or more.

Then, too, there are variables — pensions, health, kids, local cost of living, family wealth, market performance, tax laws, and even the type of retirement accounts where you keep your money. Each one can significantly alter the planning landscape, requiring individual tailoring to make the numbers add up.

That’s why advisers say coming up with a realistic plan means going back to the basics, starting with cash analysis.

“You really have to know what you spend,” said Gamel. If possible, people should start tracking expenses a year or two before retirement to get a realistic annual figure, she said. Next calculate assets and liabilities to come up with the total amount of money available in retirement. Finally add up the income from other sources such as pensions, Social Security, or ongoing employment.

With those three numbers and some quick calculations, you get a snapshot of what your retirement finances look like. Subtract your projected income from your annual spending to determine how much you’ll need from savings to pay the bills. Then divide that number by your assets to see how much of your nest egg you’ll need to maintain your lifestyle.

The goal: Make sure your annual spending doesn’t drain more than 4 percent of your pretax assets. You will need to adjust that percentage annually to reflect inflation.

Why 4 percent? Exceed that amount and the chances of stretching withdrawals over a 30-year retirement diminish dramatically. Consider a couple who has an 80 percent chance of stretching their assets over 30 years using an initial 4 percent withdrawal strategy. Increase those withdrawals to 5 percent, and chances of going 30 years drops to just 56 percent, according to investment firm T. Rowe Price.

SOURCE: T. Rowe Price Insights; GRAPHIC: JAMES ABUNDIS/GLOBE STAFF

The key spending categories as a percentage of total expenditures duing retirement

And those who retire early or who have longevity in their family may want to start with lower withdrawals, perhaps a safer 3 percent. And there’s an inflation adjustor of 3 percent built into the model from T. Rowe Price, so that even people who start withdrawals at 3 percent get to 4 percent after about 10 years.

Doing the math early gives you a chance to make adjustments. You might, for example, want to postpone retirement, reducing the years you’ll need to fund with savings. Delay taking Social Security to age 70 — the maximum age to claim benefits — and you’ll collect 32 percent more benefits than you would if you started benefits at age 66.

Of course, you can always tighten your belt and cut costs to make the number work. “You have to set your sights on a lifestyle that you’re able to maintain,” said T. Rowe Price senior financial planner Christine Fahlund.

What does a 4 percent distribution look like? A couple who spends $100,000 a year might have $50,000 of income from pensions or Social Security. Do the simple math, and it looks like they would need retirement savings of at least $1.25 million to keep their distribution within that initial 4 percent limit.

But that doesn’t include taxes. Remember, money withdrawn from IRAs and 401(k)s is taxable in most cases. That means you won’t have the full amount you withdraw.

“If you want to take $100,000 out of your retirement accounts, you have to plan on only getting $75,000 or $80,000,” said Barbara Nevils, a Wakefield-based fee-only financial planner. “The rest is going to go to taxes.”

The size of that tax bite, however, depends on which accounts you take the money from. The general rule of thumb is to use taxable assets such as brokerage accounts first. Here capital gains is the only tax incurred, and then only if you sell investments at a gain. Next in line are tax-advantaged retirement accounts such as traditional IRAs and 401(k)s. Withdrawals from these accounts are taxed as regular income. And last on the list are funds in tax-free Roth IRAs and Roth 401(k)s. This three-staged approach preserves the tax-sheltered growth of these various retirement accounts as long as possible.

The government also has some say in how you withdraw your funds, since you are required to start taking minimum distributions from traditional IRAs, 401(k)s, and most other tax-advantaged retirement accounts by April 1 of the year following the year you turn 70½. Distribution rules vary. You can bundle distributions from all your IRAs and take them from a single account of your choosing. But a distribution from your 401(k) account must be specifically taken from that account.

Fahlund recommends people consolidate their retirement accounts well before they turn 70½. “That way, you’ll have it all in one place when it comes to calculating” the required minimum distribution, Fahlund said.

Another piece of advance-planning advice: Build your cash accounts several years before retiring, said Gamel, noting that people can do this by banking a bonus, taking dividends instead of reinvesting them, or simply trimming expenses. That means you won’t be struggling to find cash or selling investments, possibly at a loss, to pay the bills.

“Having one full year of expenses going into retirement,” Gamel said, “is a great way to start.”

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.