statewage ~main

A small, dependency-free D library for U.S. take-home pay math: 2025 federal income tax brackets, FICA (Social Security + Medicare), a flat state-tax estimate, and gross-to-net and hourly-to-annual conversions.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

statewage

A small, dependency-free D library for U.S. take-home pay math — the taxes that stand between a gross salary and the number that lands in a paycheck.

It turns a wage and a filing status into the figures a paycheck calculator actually reports: 2025 federal income tax, FICA (Social Security and Medicare), a flat state income-tax estimate, and the resulting net take-home pay — plus hourly-to-annual wage conversions.

The 2025 tax-year constants and worked examples mirror the calculators at statewage.com.

Why

Everyone quotes salaries in gross dollars, but take-home pay is what matters:

Net = Gross − Federal income tax − FICA − State income tax

The federal side is exact for tax year 2025 — progressive brackets after the standard deduction, Social Security capped at the $176,100 wage base, Medicare at 1.45% with the 0.9% Additional Medicare surtax over the threshold. State income tax is a deliberately simple flat-rate estimate (pass 0 for the nine states with no wage income tax).

Install

Add it to your dub.json:

"dependencies": {
    "statewage": "~>0.1.0"
}

Usage

import statewage;
import std.stdio;

void main()
{
    // Single filer, $65,000 gross, in a 5% flat-tax state.
    auto pay = takeHomePay(65_000, FilingStatus.single, 5.0);

    writeln("federal:  ", pay.federal);       // 5,914.00
    writeln("FICA:     ", pay.fica);          // 4,972.50
    writeln("state:    ", pay.state);         // 3,250.00
    writeln("net pay:  ", pay.net);           // 50,863.50
    writeln("eff rate: ", pay.effectiveRate); // ~0.217

    // A $25/hr, 40 hr/week job as an annual salary:
    writeln("annual:   ", hourlyToAnnual(25.0, 40.0)); // 52,000
}

API

SymbolDescription
federalIncomeTax(grossWages, status)2025 progressive federal income tax after the standard deduction.
ficaTax(grossWages, status)Employee FICA: 6.2% Social Security (capped) + 1.45% Medicare + 0.9% surtax.
stateIncomeTax(grossWages, stateRatePct)Flat-rate state income-tax estimate (0 = no-tax state).
takeHomePay(grossWages, status, stateRatePct)Full PayBreakdown { gross, federal, fica, state, net } with effectiveRate.
standardDeduction(status)2025 standard deduction ($15,000 single / $30,000 married).
hourlyToAnnual(hourlyRate, hoursPerWeek, weeksPerYear = 52)Hourly wage → annual salary.
annualToHourly(annualSalary, hoursPerWeek, weeksPerYear = 52)Annual salary → hourly wage.

2025 tax-year figures

ItemValue
Standard deduction (single / married)$15,000 / $30,000
Social Security rate / wage base6.2% / $176,100
Medicare rate1.45%
Additional Medicare surtax0.9% over $200k single / $250k married
Top federal bracket37%

Worked example: a single filer earning $65,000 has $50,000 of taxable income, owing $5,914 federal (10% / 12% / 22% brackets), $4,972.50 FICA, and — in a 5% flat-tax state — $3,250 state, for $50,863.50 take-home.

Build & test

dub build
dub test

Requires a D compiler (DMD or LDC) and DUB. Every public function is @safe pure and the package has no dependencies.

License

MIT — see LICENSE.

Authors:
  • statewage
Dependencies:
none
Versions:
0.1.0 2026-Jul-16
~main 2026-Jul-16
Show all 2 versions
Download Stats:
  • 1 downloads today

  • 1 downloads this week

  • 1 downloads this month

  • 1 downloads total

Score:
0.0
Short URL:
statewage.dub.pm