API Reference¶
The crate exposes a handful of functions and constants — enough to compute a 2025 federal take-home paycheck with no dependencies.
use us_paycheck_tax::{
take_home, federal_income_tax, fica, standard_deduction, brackets,
FilingStatus,
};
take_home¶
The headline function. Returns a tuple of (net, federal_income_tax, fica) for a
given gross annual income and filing status.
net— take-home pay:gross − federal_income_tax − fica.federal_income_tax— progressive tax onmax(0, gross − standard_deduction).fica— Social Security + Medicare (+ additional Medicare if applicable).
use us_paycheck_tax::{take_home, FilingStatus};
let (net, fed, fica) = take_home(75_000.0, FilingStatus::Single);
assert!((net - 61_148.50).abs() < 0.01);
assert!((fed - 8_114.00).abs() < 0.01);
assert!((fica - 5_737.50).abs() < 0.01);
federal_income_tax¶
Progressive federal income tax on a taxable income (i.e. after the standard deduction has already been subtracted). Walks the brackets, taxing each slice at its own rate.
- Returns
0.0whentaxable <= 0.0. taxableis the post-deduction amount; callstandard_deductionto subtract it first, or usetake_homewhich does this for you.
use us_paycheck_tax::{federal_income_tax, standard_deduction, FilingStatus};
let gross = 75_000.0;
let taxable = gross - standard_deduction(FilingStatus::Single); // 60,000
let fed = federal_income_tax(taxable, FilingStatus::Single);
assert!((fed - 8_114.00).abs() < 0.01);
fica¶
FICA payroll tax on a gross income:
- Social Security —
6.2%of gross, capped at the wage base$176,100. - Medicare —
1.45%of gross (no cap). - Additional Medicare —
0.9%of gross above$200,000(single) or$250,000(married).
fica operates on gross (FICA is not reduced by the standard deduction), so pass
the pre-deduction income.
use us_paycheck_tax::{fica, FilingStatus};
// High earner: SS capped, additional Medicare applies
let f = fica(350_000.0, FilingStatus::Single);
assert!((f - 17_343.20).abs() < 0.01);
standard_deduction¶
The 2025 federal standard deduction for the filing status:
| Filing status | Standard deduction |
|---|---|
Single |
$15,000 |
Married |
$30,000 |
use us_paycheck_tax::{standard_deduction, FilingStatus};
assert_eq!(standard_deduction(FilingStatus::Single), 15_000.0);
assert_eq!(standard_deduction(FilingStatus::Married), 30_000.0);
brackets¶
The 2025 federal brackets as a slice of (ceiling, rate) pairs. The top bracket's
ceiling is f64::INFINITY. Each pair means: income up to ceiling (and above
the previous ceiling) is taxed at rate.
2025 brackets — Single¶
| Taxable income over | up to | Rate |
|---|---|---|
$0 |
$11,925 |
10% |
$11,925 |
$48,475 |
12% |
$48,475 |
$103,350 |
22% |
$103,350 |
$197,300 |
24% |
$197,300 |
$250,525 |
32% |
$250,525 |
$626,350 |
35% |
$626,350 |
+∞ |
37% |
2025 brackets — Married filing jointly¶
| Taxable income over | up to | Rate |
|---|---|---|
$0 |
$23,850 |
10% |
$23,850 |
$96,950 |
12% |
$96,950 |
$206,700 |
22% |
$206,700 |
$394,600 |
24% |
$394,600 |
$501,050 |
32% |
$501,050 |
$751,600 |
35% |
$751,600 |
+∞ |
37% |
use us_paycheck_tax::{brackets, FilingStatus};
let single = brackets(FilingStatus::Single);
assert_eq!(single[0], (11_925.0, 0.10));
assert!(single.last().unwrap().0.is_infinite()); // top bracket has no ceiling
FilingStatus¶
Pick the bracket set and deduction. Married here means married filing jointly
— the doubled brackets and doubled standard deduction.
Constants¶
All 2025 figures are exposed as pub const so you can reuse them directly:
| Constant | Value | Meaning |
|---|---|---|
STD_DEDUCTION_SINGLE |
15_000.0 |
2025 standard deduction, single |
STD_DEDUCTION_MARRIED |
30_000.0 |
2025 standard deduction, married |
SS_RATE |
0.062 |
Social Security rate (6.2%) |
SS_WAGE_BASE |
176_100.0 |
2025 Social Security wage base cap |
MEDICARE_RATE |
0.0145 |
Medicare rate (1.45%) |
ADDL_MEDICARE_RATE |
0.009 |
Additional Medicare rate (0.9%) |
Out of scope
This crate covers federal tax only. State and local income tax, pre-tax deductions (401(k), health premiums), and refundable credits are not modeled here. For the full state-by-state take-home picture, use the StateWage paycheck calculator{: target="_blank" rel="dofollow"}.