How to Calculate US Take-Home Pay in JavaScript (2026 Tax Brackets)

If you've ever built a payroll feature or a salary calculator, you know that "take-home pay" is deceptively complex. Federal brackets, FICA taxes, state taxes — each layer has its own rules. In this post, I'll walk through the actual math and show you a clean JavaScript implementation.

Want the answer without the code? Try the free US Paycheck Calculator — no signup, 2026 rates built in.

The layers of US payroll tax

For a typical W-2 employee, gross pay is reduced by:

  1. Federal income tax — progressive brackets (10% to 37%)
  2. Social Security — 6.2% on the first $176,100 (2026 wage base)
  3. Medicare — 1.45% on all wages, plus 0.9% additional Medicare tax above $200,000
  4. State income tax — varies wildly; some states have none

Federal income tax (single filer, 2026)

const FEDERAL_BRACKETS_SINGLE_2026 = [ { upTo: 11925, rate: 0.10 }, { upTo: 48475, rate: 0.12 }, { upTo: 103350, rate: 0.22 }, { upTo: 197300, rate: 0.24 }, { upTo: 250525, rate: 0.32 }, { upTo: 626350, rate: 0.35 }, { upTo: Infinity, rate: 0.37 }, ]; function federalTax(income, brackets) { let tax = 0; let prevLimit = 0; for (const { upTo, rate } of brackets) { if (income <= prevLimit) break; const taxableInBracket = Math.min(income, upTo) - prevLimit; tax += taxableInBracket * rate; prevLimit = upTo; } return tax; } 

FICA taxes

function ficaTax(grossPay) { const socialSecurity = Math.min(grossPay, 176100) * 0.062; let medicare = grossPay * 0.0145; if (grossPay > 200000) { medicare += (grossPay - 200000) * 0.009; } return socialSecurity + medicare; } 

Putting it together

function takeHomePay(grossPay, stateTax = 0) { const federal = federalTax(grossPay, FEDERAL_BRACKETS_SINGLE_2026); const fica = ficaTax(grossPay); return grossPay - federal - fica - stateTax; } 

Try it live

The US Paycheck Calculator handles all 50 states with current 2026 rates — free, private, no signup.