StubSheet Try StubSheet Free

W-2 Box 12 Codes: What Each Letter Actually Means

The first time I noticed Box 12 on my W-2, I thought something was wrong. There was a short column of codes — DD, W, D, maybe a C — followed by dollar amounts. No explanation. Just letters and numbers, sitting there like someone had typed in a password by accident.

I was using tax software at the time, and it was asking me to "enter the code from Box 12." The software had a dropdown menu with every possible code, and I had to pick the right one. I remember clicking through the list thinking: the IRS really has this many single-letter categories for things?

It does. Box 12 is weird. It's also important, because some of those codes actually affect your tax return, while others are informational and shouldn't be double-counted. This is a guide to what each of the common codes means, why they're there, and what (if anything) you need to do with them at tax time.

What Box 12 is for

The W-2 form has a limited number of boxes. Most of them are for specific things — wages (Box 1), federal tax withheld (Box 2), Social Security tax (Box 4), and so on.

Box 12 is the overflow bin. It's where employers report a bunch of different items that don't have their own dedicated box but still need to appear on the W-2 for tax purposes. To keep the form small, the IRS uses single-letter or two-letter codes instead of full labels.

Each entry in Box 12 has two parts: a code (like "D" or "DD") and an amount. The code tells you what the amount represents. Some codes affect your taxable income. Some are purely informational. Some can unlock deductions or credits. Knowing which is which is the whole game.

Your employer puts the codes there based on what happened during the year. You might have zero entries in Box 12, or you might have four. There's also usually room for 12a, 12b, 12c, and 12d — four slots for four different codes. If you have more than four, your employer might issue a second W-2 or use a statement.

The common Box 12 codes, explained

I'll go through the codes you're most likely to actually see. There are others — the full list has more than thirty codes — but most people will only encounter a handful in practice.

Code D — 401(k) elective deferral. This is your contribution to a traditional 401(k) plan for the year. It's already excluded from Box 1 (your federal taxable wages), so you don't need to deduct it again. It's reported here for the IRS to track against annual contribution limits. If you also have Roth 401(k) contributions, those show up under Code AA instead.

Code DD — Cost of employer-sponsored health coverage. This is the total value of your employer-sponsored health insurance for the year, both what you paid and what your employer paid. This is purely informational. It is not taxable. It does not reduce your taxable wages. You don't do anything with this number on your tax return. It exists because of an Affordable Care Act reporting requirement, and employers have to include it.

Every year, I see people get confused about this one, because the number is usually big — $5,000, $10,000, sometimes more. They think it's income or a deduction. It's neither. It's just a disclosure.

Code W — HSA contributions. This is the total contributed to your Health Savings Account during the year, including both your own contributions and your employer's. Important: this contribution is already excluded from Box 1 if it came through payroll (which it usually does), so don't double-count it. But if you also made HSA contributions outside of payroll — directly from your bank account, for example — those aren't in Code W, and you can deduct them separately on Form 8889.

Code C — Taxable cost of group-term life insurance over $50,000. Employer-provided life insurance up to $50,000 of coverage is a tax-free benefit. Coverage above $50,000 has an imputed value that's taxable, and Code C reports that imputed value. It's already included in your Box 1 wages — you don't have to do anything with it, but it's there for transparency.

Code E — 403(b) elective deferral. Similar to Code D, but for 403(b) retirement plans (common in education and nonprofit sectors).

Code G — 457(b) elective deferral. Similar, for 457(b) plans (common in government employment).

Code AA — Roth 401(k) contributions. Unlike Code D, Roth 401(k) contributions are after-tax — they're already included in Box 1, because they were taxed when you earned them. Code AA exists to track Roth contributions against annual limits.

Code BB — Roth 403(b) contributions. Like AA, but for Roth 403(b) plans.

Code EE — Roth 457(b) contributions. Same pattern.

Code K — 20% excise tax on excess golden parachute payments. This is rare and applies mostly to highly-compensated executives. If you see this, you probably already have an accountant.

Code P — Excludable moving expense reimbursements. Moving expense reimbursements for active-duty military members. Most civilians don't see this anymore — the 2017 Tax Cuts and Jobs Act eliminated the deduction for civilian moving expenses except for active-duty military.

Code T — Adoption benefits. Amounts your employer paid or reimbursed for adoption expenses. Not taxable up to an annual limit; excess may be taxable.

Code V — Income from exercise of nonstatutory stock options. If you exercised nonqualified stock options during the year, the bargain element (the difference between the exercise price and the market price) is reported here. It's already included in Box 1.

Codes R and S — MSA and SIMPLE retirement plan contributions. Similar to 401(k) contributions but for specific plan types.

Codes Y and Z — Deferred compensation. Deferrals under and income from nonqualified deferred compensation plans (section 409A). If this applies to you, you probably know what it is.

Codes that affect your tax return vs. codes that don't

This is the distinction that actually matters, and it's the source of most confusion.

Codes already reflected in Box 1, so you don't double-count them. Most of the pre-tax retirement contributions — D, E, G — are already excluded from Box 1, meaning your taxable wages on the W-2 are lower because of them. Don't try to deduct them again. The tax benefit is already baked in.

Codes that are purely informational. DD is the biggest example. It's the cost of your employer health coverage, reported for disclosure, with no tax impact. W (HSA contributions through payroll) is similar — already excluded from Box 1, so it's there for tracking, not for additional deductions.

Codes that might unlock additional deductions or credits. Code W specifically doesn't include HSA contributions you made outside of payroll — those can be deducted separately on Form 8889 if you contributed to your HSA directly from your bank account. Code T (adoption benefits) can interact with the adoption tax credit.

Codes that indicate income already included elsewhere. Code C (group-term life insurance above $50,000) and Code V (stock option exercises) represent compensation already reflected in your Box 1 wages. They're reported in Box 12 for transparency, not because you need to add them.

When in doubt: if a code's amount is already included in Box 1, you don't do anything extra with it. The tax treatment is already handled.

Common Box 12 mistakes

I've seen a few recurring errors when people try to enter Box 12 data manually — either because they're using tax software that doesn't match the W-2 cleanly, or because they're preparing a return by hand.

Entering Code DD as income. It's not income. It's the cost of your health coverage, reported for information only.

Double-counting Code D. People see "$10,000 in Code D" and try to deduct $10,000 on their return for a 401(k) contribution. But the $10,000 was already excluded from Box 1 — your taxable wages are already $10,000 lower. Deducting it again would mean reducing your taxable income by $20,000 instead of $10,000.

Ignoring Code W when you made outside-of-payroll HSA contributions. Code W reports what went through payroll. If you ALSO contributed directly to your HSA outside of payroll, those contributions aren't in Code W and deserve a separate deduction on Form 8889.

Confusing AA with D. Code D is pre-tax (traditional 401(k)). Code AA is post-tax (Roth 401(k)). Tax treatment is very different.

Where Box 12 data comes from on your pay stub

If you want to reconcile your Box 12 amounts against your pay stubs, here's where to look.

Your YTD deductions column on your final pay stub of the year is the source. Most of the codes correspond to specific pay stub deduction lines:

  • Code D → YTD 401(k) Traditional (or similar label)
  • Code AA → YTD 401(k) Roth
  • Code W → YTD HSA (if contributed through payroll)
  • Code DD → Total of employer + employee health insurance premiums for the year. Sometimes only shown on the stub if your employer discloses employer-paid benefits; otherwise you may need to ask HR.

If your W-2's Box 12 amounts don't match your YTD deductions, something's worth investigating — either an error, or a timing issue with how your payroll system rolls up numbers at year-end.

Getting pay stub data into a spreadsheet format makes this kind of reconciliation much easier than trying to eyeball PDFs. That's what I built StubSheet for (disclosure: I'm the creator), though you can also do it manually if you have a few stubs and some patience.

The short version

Box 12 is the W-2's miscellaneous bin — single-letter codes for various items that don't have their own dedicated box. Most codes are either informational (already reflected elsewhere) or represent pre-tax contributions (already excluded from taxable wages). Very few Box 12 codes require you to do anything additional on your tax return. The ones that matter most for regular employees are D (traditional 401(k)), DD (health insurance cost — ignore for tax purposes), and W (HSA contributions through payroll).

If you see codes you don't recognize, the full official list is in the instructions for Form W-2, which the IRS publishes every year. But for most people, the five or six codes I've walked through here will cover everything that actually shows up on their W-2.

Ready to convert your pay stub?

Upload a PDF and get a clean spreadsheet in seconds. Free for your first 3 conversions.

Try StubSheet Free