Maybe you have no choice: You have to work past the traditional retirement age of 65 because you don't yet have enough money in your retirement fund. But if you don’t have to work, does it make financial sense to continue on the job – or return to work after taking a break – when you take into account all the retirement benefits you’re going to receive? The answer is, of course, it depends.

What Happens to Social Security?

Perhaps the biggest variable to consider is Social Security. If you were born after 1960 you can’t retire before age 67 and receive full benefits. If you were born before 1960, use this calculator to figure out your normal retirement age (NRA) – also known as full retirement age.

If you plan to receive benefits earlier than your NRA and continue to work, your earnings will be subject to the “earnings test.” Here's how it works for 2016: If you will attain your NRA after 2016, you're subject to the test if you make more than $15,720; Social Security will withhold $1 of benefits for every $2 of earnings in excess of that amount. However, if 2016 is the year when you reach your NRA, the trigger amount is $41,880. If you make more than this, Social Security withholds $1 for every $3 you earned. (Visit the Social Security website for earnings test information for 2017.)

Once you reach normal retirement age for your birth date, you can make as much money as you would like – Social Security will not withhold anything.

Are you confused yet? Social Security has an online calculator to help. Crunch your numbers here. And here’s the good news. If Social Security withholds some of your benefits, you get that money back once you reach your NRA.

One more good effect of working into "retirement": Let's say that you filed for Social Security before your normal retirement age because you needed the money, even though it meant receiving reduced benefits for life. If you applied less than 12 months ago, you have the option of withdrawing your application for Social Security benefits and repaying the money you received. The advantage is that you are now resetting the clock: If you wait to re-apply for benefits until you reach normal retirement age, you will receive full benefits. If you missed the deadline, you can file to suspend your benefits to as late as age 70; they will be higher as a result.

In fact, “delaying Social Security until age 70 can be beneficial since retirees will receive an 8% gain every year after full retirement age,” says Carlos Dias Jr., wealth manager at Excel Tax & Wealth Group in Lake Mary, Fla.

Do keep taxes in mind, too. “Social Security benefits may be taxed,” says financial planner Anthony M. Lofaso, CFP®, with Palm Planning Group in West Palm Beach, Fla. If you are married filing jointly and you have between $32,000 and $44,000 in "combined income," as defined by the Social Security Administration, you may have to pay income taxes on up to 50% of your benefits. Click here for details.

Do You File for Medicare?

Medicare can get complicated. If you continue to work and have coverage through your employer, you need to file for Part A only when you reach 65. At that time, you need to tell Medicare that you are receiving employer-sponsored insurance so that you are not penalized for not filing for other parts of Medicare. See Medicare 101: Do You Need All 4 Parts? Often, it's best to stay with your employee-sponsored plan unless using Medicare would save you significant money (not generally the case).

If your spouse is younger than 65, switching to Medicare could mean that he or she would no longer have insurance through your employer. You might also have to change doctors. In addition, your employer's insurance company could require that you enroll in Medicare so it can be the secondary insurer. For a fuller discussion of these issues, see The Employee's Guide to Medicare.

Start the decision process at least three months before the month you turn 65. First talk to your employer to see whether your company-sponsored health insurance will change. Next, compare the cost and benefits of your current insurance to the cost of Medicare. Don't forget to factor in a Medigap or Medicare Advantage plan – not just the original Parts A, B and D. See Medigap vs. Medicare Advantage: Which Is Better?

Like Social Security, choosing what to do about Medicare can be complicated. A financial planner or insurance agent familiar with the program can help.

How Working Affects Your Retirement Accounts

Each type of retirement account has its own regulations and requirements.

Pension Plan – Each employer's pension plan will have its own rules. Check with the plan administrator, but you may be more affected if you return to a previous employer instead of taking a new job at a company where you haven't worked before. In general, it’s best to find a new employer to avoid pension difficulties.

Traditional IRA – Whether you work will not have any bearing on how you withdraw funds from your traditional IRA. Even if you're still working at 70½, you have to take the required minimum distribution (RMD).

However, going back to work allows you to contribute to your traditional IRA up to the catch-up contribution limit of $6,500 in 2016 until you reach 70½. You must report earned income in order to contribute to an IRA.

Roth IRA – Many of the same rules apply, but with a few key distinctions. You have to report earned income to contribute to a Roth IRA and may deposit up to $6,500, but there is no required minimum distribution at age 70½. There’s also an income cap. In 2016, if you’re married and filing a joint return, you become ineligible if you earn $194,000 or more; if you're filing as an individual, the cap is $132,000. (In 2017, those caps go up to $196,000 and $133,000, respectively.) Eligibility phases out prior to reaching the cap.

401(k) – You can contribute up to $24,000 per year if you continue to work into retirement and don’t own 5% or more of the company – even if you’re over 70½. And you don't have to take the RMD on that account. If, however, you have a 401(k) (or more than one) outside of your current employer, you would have to take the RMD on the outside account(s). The way around it: Roll any outside accounts into the 401(k) with your current employer, if that is permitted.

Annuity – Annuity payments are not affected by your employment status.

The Bottom Line

If your outstanding financial discipline allowed you to save enough to have a choice of whether to retire or not, congratulations. In most cases, any benefit money you forego by working isn’t lost – you’ll simply receive it later in life.

There are other benefits that are priceless. Having a satisfying job helps keep you healthy. Studies show that people who continue working after retirement have fewer major diseases or disabilities. For more on ways to keep working rather than moving to retirement, see Don't Retire Early – Change Careers Instead.