Your Social Security benefits are calculated based on how much you earned during your 35 highest-paid years on the job. If you file for Social Security at full retirement age, you'll get the exact monthly benefit your earnings record entitles you to. That age is either 66, 67, or somewhere in between, depending on the year you were born.

But you don't have to wait that long to claim benefits. You can file for them as early as age 62. And if your health is poor, that's often the best way to go.

Your health matters -- a lot

Claiming Social Security before full retirement age results in an automatic reduction in benefits, and filing at 62 means taking the largest hit possible. But if your health is in bad shape, and you don't expect to live a very long life, then taking benefits at 62 could make sense, because while you'll reduce your income on a monthly basis, you may come out ahead on a lifetime basis.

Older man coughing and covering his mouth.

IMAGE SOURCE: GETTY IMAGES.

Let's say you're entitled to a $1,600 monthly benefit at a full retirement age of 67. Filing at 62 instead will reduce each monthly payment you receive to $1,120. That's a big hit on your monthly income -- or so it would seem. But remember, by filing at age 62, you're getting 60 more monthly payments than you'd get by filing at 67.

Now, if you live until roughly age 78 1/2, you'll wind up mostly breaking even in both filing scenarios -- meaning, you'll end up with about $221,000 in lifetime Social Security income whether you file at 62 or 67. But watch what happens when you pass away six years sooner. If you live only until 72 1/2, you'll end up with over $35,000 more in lifetime Social Security income by claiming benefits at 62, as opposed to waiting until 67.

And that's why it's crucial to take your health into account when deciding when to file for Social Security. Though it's not an easy thing to face, if you think you're unlikely to live very long in retirement, you're often best off claiming your benefits as soon as you can.

But consider your spouse's needs, too

If you're single, then the decision to claim Social Security should boil down to your needs alone. But if you're married, then filing for benefits right away when your health is poor may not be the best move. The reason? Once you pass, your spouse will be entitled to survivors benefits. If he or she claims them at full retirement age, your spouse will be eligible to receive 100% of the amount you collected when you were alive. If you file for Social Security early and reduce your benefits in the process, you could end up hurting your spouse, especially if he or she outlives you by many years.

Going back to our example, imagine you claim your benefits at 62 and cut your monthly payments from $1,600 to $1,120. If your spouse outlives you by 20 years but is stuck collecting $1,120 a month during that time, he or she might struggle -- so take that into account as you evaluate your options.

Might your health improve?

One final thing: Before you resign yourself to dying at a relatively young age based on the state of your health, ask yourself whether there are steps you can take to turn things around to some degree. If you have a genetic condition or a progressive disease that's shortening your life span, there may not be much you can do to change your fate. But if your poor health is tied to your weight and detrimental habits, like smoking, you might manage to eke out more time by shedding some pounds and shunning cigarettes. And if that's the case, then it may not pay to take benefits as early as possible. Either way, consulting a medical professional before filing for Social Security may not be such a bad idea.

Your health should be a major driver in your decision to claim Social Security. Be honest about it, but also take your spouse's needs into account before signing up for benefits. With any luck, you'll file at the right time to get the most money possible.