I posted this in the Finance and Investment forum but there's not much traffic there. I'll repost and update here because it seems relevant.
The best way to calculate your tax withholding is to keep a spreadsheet of each paycheck so you can keep a running total throughout the year. I made one that automatically calculates my taxes on each paycheck. So I can change my W-4 withholding allowances, add overtime or change my 401(k) contributions and it will automatically recalculate the taxes.
I also put my interest, dividends, capital gains and deductions on it. Then at the bottom there is a calculation which will show if am due a refund or owe tax at the end of the year.
So, you can go to paycheckcity.com to calculate the tax withheld on ONE paycheck.
Or, the tax withholding tables are at
IRS Notice 1036. And the formula I made is:
=((([biweekly salary]-[insurance]-[401(k)])*26-3900*[W-4 allowances]-2200-87850)*0.28+17891.25)/26
Substitute the "2200-87850)*0.28+17891.25" with the numbers out of IRS Notice 1036 for your tax bracket. The 2200 is there because the tax withholding tables count the first W-4 allowance as the $6,100 standard deduction, and each allowance after that as a $3,900 exemption.
Make a spreadsheet with all 26 paychecks for the year with columns for:
Gross income
Taxable income (gross minus insurance and 401(k))
Federal tax (use the formula above)
State income tax
Social Security (6.2% up to $113,700 gross income minus insurance)
Medicare (1.45% gross income minus insurance)
Insurance
401(k)
Net
and total each column.
The next part is figuring your annual tax as you do on your tax return. This varies a lot depending on your circumstances. But basically you have your:
gross - insurance - 401(k)
+interest
+dividends
+short term capital gains
-deductions
-exemptions ($3,900 each)
==========
taxable income
Work out the tax on this using the standard tax tables. e.g.:
=([taxable income] - 87850) * 0.28 + 17891.25
Then:
+tax on long term capital gains and qualified dividends (usually 15%)
- tax credits
===========
total tax
Now subtract the tax WITHHELD from your paychecks. If the answer is positive, this is the amount you owe. If it is negative this is the amount you will be refunded.
I adjust the number of W-4 withholding allowances in my spreadsheet until the amount refunded or owed is close to $0. Do not set your W-4 withholding allowances so high that you owe a massive amount more than $1,000 on your tax return, because you could be penalized/fined by the IRS.