Nearly everyone who earns income from work has to pay Social Security payroll taxes. As much as most people would like not to have to have these taxes withheld from their paychecks, there aren't many situations in which you can get any of those taxes back.

There's one case, though, in which you might be able to get a portion of what you pay toward Social Security back. We'll take a closer look at that situation, but first, let's do a quick overview of how Social Security payroll taxes work.

3 Social Security cards with a key on top.

Image source: Getty Images.

What do I have to pay in Social Security payroll taxes?

The federal government withholds several different types of taxes from your paychecks. A certain amount goes toward federal income tax withholding, which later gets credited against what you owe the IRS on your federal tax return. If your withholding is more than the tax you owe, then you can claim a refund for the difference. If you owe more than you had withheld, then you'll have to pay the difference when you file your return.

In addition to income tax withholding, your employer will also withhold payroll taxes for Social Security and Medicare. Employees pay 6.2% of their wages in Social Security taxes and 1.45% in Medicare taxes. Your employer then pays those same amounts -- 6.2% and 1.45% of your pay -- to the federal government as its contribution toward the two programs.

Medicare taxes apply to an unlimited amount of earnings. But there's a wage base limit above which you'll no longer owe additional Social Security tax. For 2018, that wage base limit is $128,400. If you earn more than $128,400, then you'll be able to stop having the 6.2% in tax withheld once your yearly earnings go over the limit.

Why would I have too much Social Security tax withheld?

This leads to an obvious question: If your employer knows that there's an upper limit on how much Social Security tax it has to withhold on your behalf, why would you ever have too much tax taken out of your paycheck? The answer is that your employer will generally do everything it can to avoid withholding too much money from your paychecks for Social Security tax.

But there's a limit to what your employer knows. In particular, your employer doesn't know what other income you have at a different job. So if you have more than one source of earned income -- either from a second job or because you own your own business or work as a self-employed person on the side -- then it's possible that you'll have too much tax withheld.

Take a simple example in which you earn $10,000 a month at your full-time job and then earn an extra $1,000 a month part-time as an employee elsewhere. Your full-time employer will withhold $620 per month for a total of $7,440, and your part-time employer will withhold $62 per month or $744 for the year. That adds up to $8,184. But the maximum wage base of $128,400 works out to a maximum tax of $7,960.80. When you do the math, you overpaid by $223.20.

How do I get my money back?

When you file your tax return, there's a place on Form 1040 where you can indicate that you had too much money withheld for Social Security taxes. Line 71 indicates that you treat excess Social Security or the equivalent withholding for the railroad retirement program as if you had made an early payment to the IRS against your income tax liability.

So in the above example, the $223.20 will get credited on your tax return. If you would have owed tax, then you'll owe $223.20 less than your bill would have been. If you're due a refund, then it'll be $223.20 larger thanks to the excess tax paid. Making the indication on your tax return on the appropriate line is all you need to do.

Get what's coming to you

Paying Social Security payroll taxes is something most people have to do, but you shouldn't ever have to pay more than your fair share. If you work multiple jobs and earn more than the Social Security wage base limit, make sure that you don't overpay your Social Security taxes -- and if you do, be sure to claim them on your tax return.

The Motley Fool has a disclosure policy.