When you get a W-2, the government takes its cut before you ever see the money. Social Security, Medicare, all of it, handled by payroll software. When you're self-employed, you get to do that math yourself, and the "15.3% self-employment tax" everyone quotes is quietly wrong in three ways. It's 15.3% of 92.35% of your income, the Social Security half stops at a wage cap, and if you earn enough, a 0.9% surtax kicks in on top.

I built a calculator that gets all three right in a single HTML file. No frameworks, no build step, no CDN, no backend. Here's how the math works and the code behind it.

The tax formula challenge

Self-employment tax is the self-employed version of FICA: 12.4% for Social Security plus 2.9% for Medicare. Three details turn "multiply by 15.3%" into actual logic:

The 92.35% adjustment. Because the employer half of the tax is deductible, you only pay SE tax on 92.35% of your net income (IRC §1402(a)(12)).