W-2 Box 12 Codes: Pre-Tax Deferrals, HSAs, and Stock Options

The codes in Box 12 of your W-2 are shorthand labels the IRS uses to identify specific kinds of compensation, benefits, or deferrals your employer paid or withheld during the year. Most of them are informational: the amounts are already built into your Box 1 taxable wages, so you don’t touch them again on your 1040. A smaller group either unlocks a deduction, adjusts your cost basis on a stock sale, or adds tax through Schedule 2. Knowing which bucket each letter falls into is the whole point of reading Box 12.

Codes That Are Already in Your Wages

Several codes exist purely so the IRS can see how your Box 1 number was built. You don’t add them, subtract them, or enter them anywhere on your return.

Code C is the taxable cost of employer-provided group-term life insurance above $50,000. The amount is already in Boxes 1, 3, and 5. Code C explains why your Box 1 figure may sit higher than your stated salary. Adding it again would double-count the income.

Code DD shows the total cost of your employer-sponsored health coverage, combining your share and your employer’s share of the premiums. This is an Affordable Care Act reporting requirement. It is not taxable and does not affect Box 1, 3, or 5.1Internal Revenue Service. General Instructions for Forms W-2 and W-3 (2026)

Code P reports qualified moving expense reimbursements for active-duty members of the Armed Forces who moved under a military order. This exclusion applies only to military personnel. Civilian moving reimbursements are taxable and appear in Box 1 instead.2Internal Revenue Service. Frequently Asked Questions for Moving Expenses

Code J shows nontaxable sick pay from a third-party payer, such as an insurance company, when you contributed to the sick pay plan yourself. Because you funded the premiums, the benefit is tax-free and excluded from Box 1.3Internal Revenue Service. General Instructions for Forms W-2 and W-3 (2026)

Code Y flags deferrals to a nonqualified deferred compensation plan that complies with Section 409A. The amount is not in Box 1 and is not currently taxable. It will be taxed in a later year when you actually receive it. Reporting Code Y is optional for employers, so you may or may not see it.1Internal Revenue Service. General Instructions for Forms W-2 and W-3 (2026)

Code L reports substantiated employee business expense reimbursements under an accountable plan. If your reimbursement matched your documented expenses, the amount is nontaxable and stays out of Box 1. Nothing to report. If the reimbursement exceeded your documented costs, only the excess appears in Box 1 as wages.

Codes AA, BB, and EE report designated Roth contributions to a 401(k), 403(b), and governmental 457(b), respectively. Roth contributions are made with after-tax dollars, so the amounts are already included in Box 1. These codes don’t create a deduction or trigger tax. The IRS uses them to confirm you stayed within the annual deferral limit, which Roth and pre-tax contributions to the same plan type share.4Internal Revenue Service. Common Errors on Form W-2 Codes for Retirement Plans

Pre-Tax Retirement Deferrals: D, E, G, and S

These four codes track money withheld from your paycheck and sent to a retirement account before federal income tax was calculated. Because the deduction happened at the payroll level, the amounts are already excluded from Box 1. You don’t deduct them again.

  • Code D: Elective deferrals to a 401(k), including SIMPLE 401(k) plans.
  • Code E: Deferrals to a 403(b) plan, common in public schools and nonprofits.
  • Code F: (Not covered here.) The file addresses D, E, G, and S as the four pre-tax deferral codes to watch.
  • Code G: Deferrals to a 457(b) plan, typically state and local government workers.
  • Code S: Salary reduction contributions to a SIMPLE IRA.

The IRS uses these amounts to verify that your contributions stayed within the annual limits. For 2026, the elective deferral ceiling for 401(k), 403(b), and governmental 457(b) plans is $24,500, with an $8,000 catch-up at age 50 and a higher $11,250 catch-up for those turning 60, 61, 62, or 63 during the year. SIMPLE IRA deferrals have a separate $17,000 limit for 2026 with a $4,000 catch-up at 50 and older.5Internal Revenue Service. 401(k) Limit Increases to $24,500 for 2026, IRA Limit Increases to $7,5004Internal Revenue Service. Common Errors on Form W-2 Codes for Retirement Plans

Code W: Health Savings Account Contributions

Code W is one of the few Box 12 entries that directly affects your 1040. It reports the combined total of employer contributions and your own payroll-deducted contributions to a Health Savings Account. Payroll HSA contributions are excluded from federal income tax, Social Security, and Medicare, so the amount does not appear in Box 1.1Internal Revenue Service. General Instructions for Forms W-2 and W-3 (2026)

You report Code W on Form 8889. If you also made HSA contributions outside of payroll, you add those to the Code W amount on Form 8889. The form calculates your allowable deduction, which flows to Schedule 1 as an adjustment to income. It reduces your adjusted gross income whether you itemize or take the standard deduction.

For 2026, the maximum HSA contribution is $4,400 for self-only coverage and $8,750 for family coverage, with a $1,000 catch-up at age 55 and older. Contributions above the limit that stay in the account are hit with a 6% excise tax each year, reported on Form 5329.6Internal Revenue Service. Expanded Availability of Health Savings Accounts Under the One, Big, Beautiful Bill Act (OBBBA) – Notice 2026-5

Codes That Add Tax on Schedule 2

A few Box 12 entries signal you owe tax beyond what your paycheck withheld. Each of these requires an entry on Schedule 2, Additional Taxes.

Code Z: Failed Nonqualified Deferred Compensation

Code Z is income from a nonqualified deferred compensation plan that violated Section 409A. The amount is already in Box 1, but on top of regular income tax, you owe a 20% additional tax plus interest. This goes on Schedule 2, Part II. The interest calculation is complicated enough that most people benefit from professional help; the penalty is steep enough that getting it wrong is expensive.

Codes M and N: Uncollected Payroll Taxes

Code M reports uncollected Social Security tax, and Code N reports uncollected Medicare tax, both on the taxable cost of group-term life insurance above $50,000 provided to former employees. These codes appear when your employer covered you after you left but had no wages left to withhold from. You owe the taxes directly on Schedule 2.1Internal Revenue Service. General Instructions for Forms W-2 and W-3 (2026)

Code V: Nonstatutory Stock Option Income

Code V reports compensation from exercising nonstatutory stock options. The amount is the spread between the stock’s fair market value at exercise and the price you paid. It is already included in Boxes 1, 3, and 5, so Code V by itself doesn’t change your return.1Internal Revenue Service. General Instructions for Forms W-2 and W-3 (2026)

It matters when you sell the stock. The Code V amount gets added to your exercise price to determine your adjusted cost basis. Many 1099-B forms don’t reflect this adjustment, showing a cost basis that’s too low. If you don’t correct it on Form 8949, you’ll pay tax on the same income twice — once as wages when you exercised, and again as capital gain when you sold. The corrected gain or loss then flows to Schedule D. This is one of the most common spots where taxpayers accidentally overpay.

Code Q: Combat Pay and the EITC Election

Code Q reports nontaxable combat zone pay for members of the military. It is excluded from Box 1 and owes no federal income tax. Where it becomes interesting is with the Earned Income Tax Credit.

By default, nontaxable combat pay is excluded from the earned income calculation for the EITC. You can elect to include it. The rule is all-or-nothing: the entire Code Q amount or none of it, no partial election. Inclusion helps some service members and hurts others, depending on where your total earned income lands on the EITC curve. Adding combat pay can push you into the phase-out and reduce or eliminate the credit, or it can boost earned income enough to raise the credit substantially. Run it both ways before you choose.

The Excess Deferral Trap Across Multiple Employers

Retirement deferral codes don’t flag one common problem on their own: if you worked for more than one employer during the year, your combined Code D, E, G, or S amounts across all W-2s must fit under a single annual limit. You have to add them up yourself.

If the total exceeds the limit, you must notify one of your plan administrators and request a corrective distribution of the excess plus any earnings on it by April 15 of the following year. That deadline is fixed and does not shift if you file an extension. The excess is taxable in the year contributed; the earnings are taxable in the year distributed. The corrective distribution comes back to you on Form 1099-R.7Internal Revenue Service. Retirement Topics – 401(k) and Profit-Sharing Plan Contribution Limits

Miss April 15 and the excess is taxed when contributed and taxed again when distributed later. Same dollars, taxed twice. A timely correction avoids it entirely, which makes this one of the more expensive deadlines to miss.

Rarer Codes You May See

Code H reports elective deferrals to a Section 501(c)(18)(D) tax-exempt organization plan. Despite what some payroll guides suggest, Code H is not for SEP contributions. These plans are uncommon, and unlike other deferral codes, the amount is included in Box 1 wages. You claim the deduction on your return rather than having it excluded at the payroll level.4Internal Revenue Service. Common Errors on Form W-2 Codes for Retirement Plans

Code R reports employer contributions to an Archer Medical Savings Account, a predecessor to the HSA. If you still have an Archer MSA, employer contributions shown under Code R go on Form 8853, not Form 8889. Contributions within the allowable limits are excluded from income.3Internal Revenue Service. General Instructions for Forms W-2 and W-3 (2026)