US W-2 Wage and Tax Statement

Extract structured data from IRS Form W-2 including employer/employee information, wages, withholdings, and state tax details.

The fields this preset extracts.

employee_addressstring

Home mailing address of the employee.

employee_namestring

Full legal name of the employee.

employee_ssnstring

Social Security Number (9 digits without dashes or spaces).

employer_addressstring

Full business address of the employer.

employer_instring

Employer Identification Number (9 digits without dashes).

employer_namestring

Legal name of the employer.

federal_income_tax_withheld_usd_centsinteger

Federal income tax withheld in USD cents.

medicare_tax_withheld_usd_centsinteger

Medicare tax withheld in USD cents.

medicare_wages_and_tips_usd_centsinteger

Medicare wages and tips in USD cents.

social_security_tax_withheld_usd_centsinteger

Social Security tax withheld in USD cents.

social_security_wages_usd_centsinteger

Social Security wages in USD cents.

state_codestring

Two-letter state abbreviation for state withholding (if applicable).

state_income_tax_usd_centsinteger

State income tax withheld in USD cents.

state_wages_usd_centsinteger

State wages in USD cents (if state income tax applies).

tax_yearinteger

Tax year as a 4-digit integer (e.g., 2024).

wages_tips_other_compensation_usd_centsinteger

Total wages, tips, and other compensation in USD cents (e.g., 50000 for $500.00).

curl
curl -X POST 'https://app.staging.xberg.io/v1/extract' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -F 'file=@your-document.pdf' \
  --form-string 'options={"preset":"w2_us"}'
Call mode
Text only
Citations
Enabled
Version
v1

The instructions Xberg gives the AI model when it extracts this document type.

You are a precise structured-data extractor for IRS Form W-2 (Wage and Tax Statement). Extract all fields exactly as printed on the form. Do not infer or estimate values. All monetary amounts are in USD cents (integers — multiply displayed dollar amounts by 100). Names, addresses, and identification numbers must be extracted literally. SSN format: exactly 9 digits without dashes or spaces. IN format: exactly 9 digits. Tax year is a 4-digit integer. State code is a 2-letter abbreviation (optional). Dates are ISO-8601 strings (YYYY-MM-DD) if present. Include all wage totals, federal withholding, Social Security wages and tax, Medicare wages and tax, and state-level data if present. If a field is absent or illegible, omit it from the output. Ensure all monetary values are consistent. If the document does not match this preset, return {}. Extract only values supported by the document. Omit absent, illegible, or incomplete values, including within nested objects, while retaining other supported values. Do not infer, guess, supply defaults, or calculate missing values. Omit dates whose complete year, month, and day are not explicit. Do not emit null or placeholder strings such as "null" or "2023-XX-XX" for missing values.

Open-source primitives, composed into one backend. Curated cohort of design partners. Apply to work with us.

We value your privacy

Xberg uses cookies to improve your experience, personalize content, and analyze traffic. You can manage your preferences at any time.