๐ช๐ต๐ฎ๐ ๐ ๐๐ฒ๐ฎ๐ฟ๐ป๐ฒ๐ฑ ๐๐๐ถ๐น๐ฑ๐ถ๐ป๐ด ๐ฎ ๐ฃ๐ฎ๐๐ฐ๐ต๐ฒ๐ฐ๐ธ ๐๐ฎ๐น๐ฐ๐๐น๐ฎ๐๐ผ๐ฟ
Most paycheck calculators are bad.
They hide behind ads. They force you to give your email address. I wanted a simple answer to one question: If I earn X in my state, how much money hits my bank account?
I built my own tool. Then I tried to add all 50 US states.
The logic started easy.
Federal tax follows a standard progressive structure. I wrote a function to loop through tax brackets. For 2025, I subtract the standard deduction first.
Social Security and Medicare are also straightforward. I apply the 6.2% rate up to the wage base and the 1.45% Medicare rate to all wages.
Then I hit the state taxes. States are not uniform.
Some states have no income tax. Others use complex brackets. The hardest part is how states treat federal taxes.
- Alabama lets you subtract your entire federal tax from your state taxable income.
- Oregon caps that subtraction at a specific amount. It changes every year.
This creates a problem for your code. You cannot use a simple formula for every state. You need a shared context that carries federal tax data.
I solved this with a specific architecture.
I created a StateConfig type. Most states follow a default path using brackets and deductions. For the strange states, I use a computeOverride function.
This allows me to write custom logic for specific states without breaking the rest of the system. It keeps the messy rules contained in one place.
Building this taught me that edge cases define the quality of your software.