Build SSA W-2 EFW2 File (Publication 42-007)
Skill: Convert payroll data into an EFW2 fixed-width file for SSA filing
Region: United States Category: Payroll Does: Takes annual payroll data and assembles the EFW2 fixed-width file that employers upload to the SSA Business Services Online (BSO) portal to electronically file Form W-2 Copy A. Spec: SSA Publication 42-007 (EFW2)
Every EFW2 record is exactly 512 characters, fixed-position ASCII, no delimiters. Field byte-positions and the set of required fields change by tax year — always verify the layout against the current Publication 42-007 before generating. The tables below give record purpose and the key fields, not every byte offset.
When e-filing is required
- An employer filing 10 or more W-2s (aggregated with other information returns) must file electronically.
- W-2 Copy A goes to SSA (not the IRS); state copies go to the state. Federal due date is January 31 (rolls to the next business day on a weekend/holiday — e.g. February 2, 2026).
Record sequence
RA Submitter Record (once, first)
RE Employer Record (one per employer)
RW Employee Record (one per employee)
RO Employee Optional Record (optional, follows its RW)
RS State Record (optional, per state per employee)
RT Total Record (totals for the preceding RE's RW records)
RU Total Optional Record (optional, totals of RO records)
... repeat RE...RT per employer ...
RF Final Record (once, last)
RE opens an employer block; RT closes it with control totals; RF ends the file.
Key fields by record
RA — Submitter
| Field | Notes |
|---|---|
| Submitter EIN | 9 digits |
| User Identifier (BSO User ID) | the submitter's SSA-issued ID |
| Software/vendor code, company name, address | contact + transmission metadata |
| Contact name, phone, email |
RE — Employer
| Field | Notes |
|---|---|
| Tax year | 4 digits (e.g. 2025) |
| Employer EIN | 9 digits |
| Employer name, address | |
| Kind of Employer / Employment Code | e.g. Regular (941), Household, Agricultural |
RW — Employee (the core W-2)
| Field | W-2 box |
|---|---|
| Employee SSN | (a) |
| Employee name (first, middle, last), address | (e)/(f) |
| Wages, tips, other compensation | Box 1 |
| Federal income tax withheld | Box 2 |
| Social Security wages / Social Security tax withheld | Box 3 / Box 4 |
| Medicare wages and tips / Medicare tax withheld | Box 5 / Box 6 |
| Social Security tips | Box 7 |
| Dependent care benefits, deferred comp (401k etc.) | Box 10, Box 12 codes |
RS — State (optional but usually required for state filing)
| Field | Notes |
|---|---|
| State code (numeric FIPS) | |
| Employer state ID number | |
| State wages, state income tax withheld | Boxes 16 / 17 |
| Local wages / local tax / locality name | Boxes 18–20 |
RT — Total (per employer block)
Sum of the RW fields: total Box 1 wages, total federal tax withheld, total SS wages, total SS tax, total Medicare wages, total Medicare tax, etc., plus the count of RW records.
RF — Final
Total number of RW records in the entire file.
Data rules
- Every record is padded/truncated to exactly 512 bytes; numeric money fields are right-justified, zero-filled, in cents with no decimal point (e.g.
$1,000.00→000000100000). - Names follow SSA formatting (no titles/suffixes in the name fields where the spec excludes them); SSNs are 9 digits, no dashes.
- RT totals must reconcile exactly with the sum of the RW records in that employer block; RF must equal the total RW count in the file.
- Use ASCII; BSO submissions use ASCII-1.
Worked example (field breakdown, then assembled fixed-width)
For one employer, one employee earning $60,000 (Box 1), $6,000 federal withheld, full SS/Medicare:
RE TaxYear=2025 EmployerEIN=123456789 Name=ACME LLC ...
RW SSN=123456789 Name=JANE DOE Box1=6000000 Box2=600000
SSWages=6000000 SSTax=372000 MedWages=6000000 MedTax=87000
RT NumberOfRW=1 TotalBox1=6000000 TotalBox2=600000
TotalSSWages=6000000 TotalSSTax=372000
TotalMedWages=6000000 TotalMedTax=87000
RF NumberOfRW=1
(Box 1 $60,000 = 6000000 cents; SS tax 6.2% = $3,720 = 372000; Medicare 1.45% = $870 = 87000.) Each line is then written as a 512-character fixed-position record per Publication 42-007.
Validation checklist
- Submitter enrolled in SSA Business Services Online with a BSO User ID
- One RA at the top, one RF at the bottom; RE…RT block per employer
- Every record padded to exactly 512 characters
- Money fields in cents, right-justified, zero-filled, no decimal point or symbols
- SSNs and EINs are 9 digits, no dashes
- RT totals reconcile with the employer's RW records; RF count = total RW records
- Tax year correct in RE; deadline (Jan 31 / next business day) met
- File validated with SSA AccuWage (or equivalent) before upload to BSO
Last updated: 2026-05-26 — verify exact field byte-positions, required fields, money-field formatting, and the record set against the current SSA Publication 42-007 (EFW2) for the tax year before use.