I recently added a paycheck calculator for every US state plus Washington DC to InovoTools, a free tools site I run. Everything runs in the browser: no API calls, no server, no stored data. Here is how the calculation is structured, and the parts that were harder than they looked.
One data file, one function
The core is a single table keyed by state, with the tax year written into the file itself (simplified here):
type Bracket = [upTo: number, rate: number]; interface StateTax { brackets: { single: Bracket[]; married: Bracket[] }; stdDeduction: { single: number; married: number }; perDependent: number; } export const TAX_YEAR = 2026; export const SOURCE_DATE = '2026-02-11'; // shown on every result Every page then calls the same function with a state slug. That keeps 51 tools consistent: a fix in the engine fixes all of them.
function bracketTax(income: number, brackets: Bracket[]): number { let tax = 0, lower = 0; for (const [upTo, rate] of brackets) { if (income <= lower) break; tax += (Math.min(income, upTo) - lower) * rate; lower = upTo; } return tax; } Flat tax states are just one bracket with upTo: Infinity. States with no wage tax (Texas, Florida, Nevada and others) have an empty list.
What made it harder than a loop
Payroll contributions are not income tax. Several states take a slice for disability or paid family leave: California SDI, New York PFL and DBL, New Jersey TDI and FLI, Washington PFML and WA Cares, Massachusetts, Rhode Island, Oregon and more. Some have a wage cap, some a dollar cap. I keep them in a separate table so the result can show them as their own line.
Local taxes. Maryland counties add 2.25% to 3.30% on top of the state rate, so Maryland gets a county default with a note.
Odd rules. Alabama lets you deduct federal income tax before applying the state rate, with phase-outs. That one needs its own branch, not a bracket.
Dates go stale. Tax data is only correct for one year. Each result ends with a line naming the tax year and the source date, so a reader can tell when it was last checked. I would recommend this for any calculator whose numbers depend on a date.
Testing
A test runs every one of the 51 state tools with its default inputs and checks that each returns a result and has its own page copy. Next on my list is a fixed salary fixture per state, so that when the brackets change next year the failing tests show exactly which states moved.
Try it
- California paycheck calculator
- Texas paycheck calculator
- New York paycheck calculator
- Federal tax bracket calculator
If you build something similar, keep the data separate from the logic and put the date on the output. It saves a lot of support questions.
I built InovoTools; feedback on the edge cases is welcome in the comments.