# What Is Box 12 on W2? The Coded Box, Explained

- Canonical: https://schematax.com/blog/what-is-box-12-on-w2
- Author: Schema Tax (https://schematax.com)
- Published: 2026-07-05T14:23:46.000Z
- Updated: 2026-07-05T14:23:46.000Z

Box 12 on a W2 is where your employer reports specific benefits and amounts that need their own label, such as 401(k) deferrals, HSA contributions and the cost of health coverage. Each entry pairs a letter code with a dollar figure. Most Box 12 amounts are not extra income; they explain why Box 1 wages differ from your salary.

## Why the IRS gives Box 12 letter codes

The IRS gives Box 12 letter codes because one small box has to carry many kinds of information. The 2026 instructions define more than 30 codes, from code A for uncollected tax on tips to code TT for overtime. A paper W-2 has room for four entries, so the letter tells the reader which item each amount is.

A separate box for every benefit would make the form several pages long, and most of those boxes would be empty for most workers. A letter code avoids that. The employer prints only the items that apply to the employee, and the letter tells the reader, the IRS and the Social Security Administration what each number means.

The [IRS General Instructions for Forms W-2 and W-3 (2026)](https://www.irs.gov/instructions/iw2w3) make the code mandatory. They say: "Even if only one item is entered, you must use the IRS code designated for that item." An employer cannot print a bare dollar amount and let the reader guess.

The same instructions say the code letters "do not relate to where they should be entered in boxes 12a through 12d." Code A does not have to sit in slot 12a. An employee whose only Box 12 item is a 401(k) deferral will usually see code D in the first slot, 12a. The [guide to the 12a, 12b, 12c and 12d slots](/blog/12a-on-w2) explains how to read each slot.

The letters fall into rough groups: retirement plan contributions, health benefits, uncollected taxes and a handful of income items such as stock option spread. The [full Box 12 code table from A to TT](/blog/w2-box-12-codes#the-full-box-12-code-table-from-a-to-tt) lists every letter with what it reports.

## Is a Box 12 amount extra income?

A Box 12 amount is not extra income to add on top of Box 1. Each entry describes something the employer already accounted for when it filled in the wage boxes. Some Box 12 amounts were left out of Box 1, some are already inside it, and some, like code DD, were never taxable income at all.

Three examples show the range. A code D amount is pay the employee deferred into a 401(k); the instructions tell employers not to include elective deferrals in Box 1, so it is already outside the wage total. A code AA amount is a Roth 401(k) contribution; the Box 1 instructions list designated Roth contributions as included, so it is already inside. A code DD amount is the cost of employer health coverage, which the instructions say is not taxable.

In none of those cases does the reader add the Box 12 figure to Box 1. Adding it would count the same dollars twice, or count dollars that are not income.

A few codes do carry information that matters on a return. The [Instructions for Form 8889](https://www.irs.gov/instructions/i8889) point to code W for employer HSA contributions, and the [Instructions for Form 8839](https://www.irs.gov/instructions/i8839) point to code T for adoption benefits. That is a reporting step, not extra wages. The [code-by-code guide to what you put for Box 12 on your taxes](/blog/what-do-i-put-for-box-12-on-my-taxes) covers where the IRS instructions send each code.

Some codes report taxes instead of pay. Codes A and B are social security and Medicare tax on tips that the employer could not collect, and codes M and N are the same for group-term life coverage of former employees. These are amounts of tax, so treating them as income would be a category error.

## How Box 12 amounts relate to Box 1 wages

Box 12 amounts relate to Box 1 wages by explaining the gap between salary and taxable wages. When an employee defers part of their pay into a 401(k), Box 1 drops by the deferral and Box 12 shows the deferred amount with code D. Social security wages in Box 3 and Medicare wages in Box 5 do not drop.

The rule comes from two lines in the [IRS General Instructions for Forms W-2 and W-3](https://www.irs.gov/instructions/iw2w3). The Box 1 section says not to include elective deferrals such as 401(k) contributions. The Box 3 section says to report deferrals under codes D, E, F, G and S in Box 3 "even though the deferrals are not includible in box 1." Box 5 follows Box 3 for this purpose, without a wage base limit.

### A worked example

The figures below belong to a fictional employee, Jordan Example, SSN XXX-XX-1234. They are example values only. Jordan earned a salary of $68,000, deferred $6,800 into a 401(k), and was covered by an employer health plan whose total cost was $9,450 for the year. Assume no other pre-tax deductions.

| Line | Example value | How it is reached |
| --- | --- | --- |
| Salary for the year | $68,000.00 | From the employment agreement |
| Box 12a, code D | 6800.00 | 401(k) deferral Jordan elected |
| Box 12b, code DD | 9450.00 | Cost of employer health coverage |
| Box 1 wages | 61200.00 | $68,000 minus the $6,800 deferral |
| Box 3 social security wages | 68000.00 | Deferral stays in, under the Box 3 rule |
| Box 5 Medicare wages | 68000.00 | Same as Box 3 here, no wage base issue |

The code D amount explains the difference between Box 1 and Box 3 exactly: $68,000 minus $61,200 is $6,800. The code DD amount explains nothing about the wage boxes, because it is neither pay nor a deduction from pay. It is a report of what the coverage cost.

Boxes 3 and 5 match in this example because $68,000 is under the 2026 social security wage base of $184,500 stated in the instructions. A higher earner would see Box 3 capped at the wage base and Box 5 continue above it.

If Jordan had also made a $1,200 Roth 401(k) contribution, it would appear as code AA. Box 1 would not drop for it, because the instructions include designated Roth contributions in Boxes 1, 3 and 5. The broader reasons the three wage boxes differ are covered in the [W-2 forms category](/blog/category/w-2-forms), and the [steps to check W-2 math](/blog/check-w2-math) turn this arithmetic into a test you can run on any form.

## Who decides what goes in Box 12

The employer fills in Box 12, but it does not choose the entries freely. The IRS instructions say to "complete and code this box for all items described below," so any benefit on the IRS list must be reported with its assigned code. Payroll software applies those rules, and the employer supplies the plan and benefit data behind them.

The instructions leave a few choices open. Code Y for section 409A deferrals is optional: the instructions say it is not necessary to show those deferrals in Box 12. Code DD has transitional relief for certain employers and plan types, so not every employer must report health coverage cost. Box 14a is a free-form box where an employer may add other information, such as union dues or employer matching contributions.

Other items are required. The instructions say employers must report all employer contributions to an HSA in Box 12 with code W, and all employer contributions to an Archer MSA with code R. Adoption benefits under code T must be reported in full, including any amount above the $17,670 exclusion stated in the 2026 instructions.

The employer also decides the order of entries across the four slots, since the instructions say codes are not tied to particular slots. What it cannot do is invent a code, skip the code, or put an item in Box 12 that the instructions send elsewhere. The instructions say section 414(h)(2) contributions go in Box 14a, not Box 12. The [plain-language guide to the IRS Box 12 instructions](/blog/box-12-instructions-w2) lists the employer's steps in order.

## What does a Box 12 entry look like when software reads a W2?

When software reads a W2, a Box 12 entry becomes a pair of values: a code and an amount, kept together. The pair has to stay linked, because an amount without its code has no meaning. A good extraction also records which slot, 12a through 12d, the pair came from, so the data can be checked against the paper form.

The instructions describe the printed layout that software reads. The code goes to the left of a vertical line in each of boxes 12a through 12d, and the amount goes to the right. Amounts use a decimal point but no dollar sign or commas, so the instructions' own example of a $5,300 401(k) deferral reads "D 5300.00".

Here is one way to hold Jordan's two entries as data. The structure is an illustration of the idea, not any product's schema.

```json
{
  "box12": [
    { "slot": "12a", "code": "D", "amount": 6800.00 },
    { "slot": "12b", "code": "DD", "amount": 9450.00 }
  ]
}
```

A flat layout with one column per slot, such as `box12a_code` and `box12a_amount`, works for spreadsheets. The list layout above works better in code, because it handles a second W-2 that carries extra codes without new columns.

Schema Tax treats Box 12 this way: it reads each slot on a W-2 into a typed field with a fixed name, keeps the box number with the value, and exports the result as JSON, CSV or Excel. The [supported forms list](/#forms) shows what else it reads from a W-2.

## When Box 12 on a W2 needs a second look

Box 12 on a W2 needs a second look when an entry breaks the rules the IRS sets for it. An amount with no code, a letter that is not on the IRS list, or a code that does not fit your benefits all suggest a payroll error. So does a deferral larger than you elected.

An amount with no code is the clearest problem. The instructions require a code even when there is only one item. A form that shows "6800.00" in 12a with an empty code column cannot be read with confidence, and the employer is the one who can say what it is.

A letter that is not on the current list is the next problem. The 2026 list has no code I, O, U or X and no CC. A letter outside the list may be a print or scan error, or a code from an older edition of the instructions.

A code that does not match your situation is worth a question. Code Q is nontaxable combat pay, which only military employers report. Code P is limited to members of the Armed Forces and the intelligence community. If one of those appears on a civilian's form, the code may be wrong.

Large deferral amounts deserve a check too. Employers report the full amount deferred under code D, even above the yearly limit explained in the [section on the shared deferral limit](/blog/box-12-code-e-vs-d#the-shared-deferral-limit-across-code-d-and-code-e-plans). A figure above your own records may mean the payroll system counted something twice.

When an error is confirmed, the employer corrects it on Form W-2c. The instructions say to use the W-2c to correct coded Box 12 items, entering both the code and the dollar amount.
