Skip to content

us-paycheck-tax

2025 US federal income tax (progressive brackets + standard deduction) and FICA take-home math in pure Rust.

us-paycheck-tax is a small, dependency-free crate that computes the federal income tax and FICA (Social Security + Medicare) owed on a paycheck, then hands you the take-home pay. It is the same math engine behind the StateWage paycheck calculator{: target="_blank" rel="dofollow"}.

crates.io docs.rs


Why this exists

A paycheck has two layers of federal tax that almost everyone gets wrong by hand:

  1. Federal income tax is progressive — each chunk of taxable income is taxed at the bracket rate for that chunk only, not the whole salary at your top rate.
  2. FICA is flat but capped — Social Security stops at a wage base, and an additional Medicare surcharge kicks in above a threshold.
take_home = gross − federal_income_tax(taxable) − fica(gross)
taxable   = max(0, gross − standard_deduction)

The crate ships exactly those three pieces: progressive bracket math, the standard deduction, and FICA with its caps and surcharges. No state tax, no pre-tax deductions — just the federal core, correct and readable.

Features

  • Zero dependencies. Pure f64 arithmetic, no std bloat, no feature flags.
  • 2025 IRS figures. Standard deduction ($15,000 single / $30,000 married), seven progressive brackets (10% → 37%), and current FICA constants.
  • Correct caps. Social Security stops at the $176,100 wage base; the 0.9% additional Medicare tax triggers above $200k (single) / $250k (married).
  • Both filing statuses. Single and Married brackets and deductions.
  • Tested. Unit tests assert progressive-bracket sums, FICA caps, and take-home positivity.

Install

Add the crate to your Cargo.toml:

[dependencies]
us-paycheck-tax = "0.1"

Or pull it in with cargo:

cargo add us-paycheck-tax

Quick start

use us_paycheck_tax::{take_home, FilingStatus};

let (net, fed, fica) = take_home(75_000.0, FilingStatus::Single);
// net   ≈ $61,148.50
// fed   ≈ $8,114.00
// fica  ≈ $5,737.50

Head to the API reference for the full function list and the 2025 bracket table, or the examples page for worked paycheck calculations across filing statuses and income levels.

Live calculator

For an interactive version that layers in state and local tax too, use the free paycheck calculator{: target="_blank" rel="dofollow"} at StateWage. It runs this same federal engine in the browser and shows take-home pay by state.

License

MIT. See the crate repository for the source and contribution guide.