How the USA self-employed (federal) calculator is verified

Inputs

InputFieldType
Annual net business earnings (USD)netEarningsnumber

The formula

Each derived value below is computed by the Valem engine from the expression shown, in this order. Nothing else runs — there is no hidden code path.

Derived valueFieldFormula (JSONata)
Se Tax BaseseTaxBase$round(netEarnings * $const.seBase, 2)
Self-employment taxselfEmploymentTax$round($const.ssRate * $min([seTaxBase, $const.ssWageBase]) + $const.medicareRate * seTaxBase, 2)
QBI deduction (20%)qbiDeduction$round($const.qbiRate * $max([0, netEarnings - selfEmploymentTax / 2]), 2)
Taxable IncometaxableIncome$round($max([0, netEarnings - selfEmploymentTax / 2 - qbiDeduction - $const.standardDeduction]), 2)
Federal income taxfederalIncomeTax($t := taxableIncome; $round($const.r1 * $min([$t, $const.b1]) + $const.r2 * $max([0, $min([$t, $const.b2]) - $const.b1]) + $const.r3 * $max([0, $min([$t, $const.b3]) - $const.b2]) + $const.r4 * $max([0, $min([$t, $const.b4]) - $const.b3]) + $const.r5 * $max([0, $min([$t, $const.b5]) - $const.b4]) + $const.r6 * $max([0, $min([$t, $const.b6]) - $const.b5]) + $const.r7 * $max([0, $t - $const.b6]), 2))
Net income / year (federal only)netIncome$round($max([0, netEarnings - selfEmploymentTax - federalIncomeTax]), 2)

Rates and thresholds

The expressions above read these as $const. They are the figures the annual refresh replaces, so they live as data rather than being written into the formulas — which is what makes a year-on-year change a one-line diff instead of an edit to arithmetic.

ConstantValue
seBase0.9235
ssRate0.124
medicareRate0.029
ssWageBase184500
qbiRate0.2
standardDeduction16100
b112400
b250400
b3105700
b4201775
b5256225
b6640600
r10.1
r20.12
r30.22
r40.24
r50.32
r60.35
r70.37

Test vectors (3)

Every case is executed against this model on each build, by the Java engine and independently by a JavaScript one. A mismatch of a single cent fails the build, so the page cannot ship advertising a figure the model no longer produces.

Case 1 — 100,000 USD net earnings — a typical full-time contractor

given netEarnings100000
expect seTaxBase92350
expect selfEmploymentTax14129.55
expect qbiDeduction18587.05
expect taxableIncome58248.18
expect federalIncomeTax7526.6
expect netIncome78343.85

Case 2 — 40,000 USD — part-time

given netEarnings40000
expect seTaxBase36940
expect selfEmploymentTax5651.82
expect qbiDeduction7434.82
expect taxableIncome13639.27
expect federalIncomeTax1388.71
expect netIncome32959.47

Case 3 — 250,000 USD — above the Social Security wage base

given netEarnings250000
expect seTaxBase230875
expect selfEmploymentTax29573.38
expect qbiDeduction47042.66
expect taxableIncome172070.65
expect federalIncomeTax33894.96
expect netIncome186531.66

Sources

Check it yourself — and reuse it

The whole model as JSON — inputs, outputs, formulas, vectors and sources in one re-runnable document.

This model is published under CC BY 4.0: use it, adapt it, build on it, with attribution. The licence covers the model — the expression of each rule and the arrangement of the catalog. The rates and thresholds are law, and nobody licenses those; the sources above are where they come from.

← Back to the USA self-employed (federal) calculator

Built with Valem — a live, verifiable calculator you can fork and embed.