Every January, millions of HSA holders spot a cryptic entry on their W-2: box 12 code W with a dollar amount next to it. Most people assume this is their employer's HSA contribution. The surprise? That number includes every dollar you contributed through payroll deduction too. The IRS treats all payroll-based HSA funding as "employer contributions," and misunderstanding this creates the single most common HSA tax mistake - accidentally claiming the same deduction twice. Here is what box 12 code W really means, where it goes on Form 8889, and how to avoid a costly penalty.
What You Need to Know About Box 12 Code W
- Box 12 Code W shows employer contributions to your HSA, including your own payroll deductions
- The IRS treats payroll contributions through a cafeteria plan as employer contributions
- This amount goes directly to Form 8889 Line 9, not Line 2
- The most common HSA tax error is double reporting these contributions
What Is Box 12 Code W on Your W-2
Box 12 on your W-2 can contain multiple entries with different letter codes. Code D is for 401(k) contributions, Code DD is for health coverage costs, and Code W specifically identifies HSA-related contributions.
Code W shows the total pre-tax contributions to your HSA, regardless of whether they came from you or your employer. When contributions are made pre-tax through payroll, the IRS considers them "employer contributions" for Form 8889 purposes - even though the money came from your paycheck.
Why the classification? When HSA dollars are deducted from your paycheck before taxes, they were never part of your taxable income. They bypass both income tax and FICA taxes (Social Security and Medicare). That is a better deal than contributing after-tax and claiming a deduction later.
Good to Know
FICA savings bonus: Pre-tax payroll HSA contributions save you the 7.65% FICA tax that after-tax contributions do not. On a $4,300 contribution, that is an extra $329 in your pocket.
This classification directly affects how you report contributions on Form 8889, which every HSA holder must file if contributions were made or distributions taken during the tax year.
What Is Included in the Code W Amount
The Code W amount is a combined total. It includes three types of contributions:
- Your payroll deduction contributions - every dollar you elected to contribute through your employer's payroll system
- Direct employer contributions - flat contributions, matching contributions, or per-pay-period amounts your employer adds as a benefit
- Cafeteria plan (Section 125) contributions - the mechanism most employer HSA programs use to allow pre-tax deductions
There is no breakdown on the W-2 itself. If you contributed $3,000 through payroll and your employer added $1,200, your box 12 code W simply shows $4,200.
What is NOT included in Code W:
- Contributions you made directly to your HSA outside of payroll (post-tax contributions from your checking account)
- Contributions made in the following year for the current tax year
- Rollovers from another HSA or Archer MSA
- Qualified HSA funding distributions from an IRA
Important
Watch for errors: Box 12 code W should only show HSA contributions, not healthcare premiums. If the amount seems unusually high, verify your employer did not mistakenly include premium payments.
You can verify the breakdown by checking your final pay stub of the year or your HSA provider's annual statement (Form 5498-SA). You can also verify your contribution limit to make sure you are within bounds.
Where Code W Goes on Form 8889
This is where proper HSA tax filing comes together. Your box 12 code W amount flows to a specific line on Form 8889:
- Line 2 - Only contributions you made outside of payroll with after-tax dollars. If all your contributions went through payroll, this is $0.
- Line 9 - Your box 12 code W amount goes here. This captures everything your employer and you contributed through payroll.
- Line 13 - Your HSA deduction. This is calculated from Line 2, so if Line 2 is $0, your deduction is $0. You already got the tax benefit through payroll.
The math ensures you do not get a double deduction. Your Code W contributions were already excluded from Box 1 wages on your W-2, so they cannot be deducted again.
Pro Tip
Tax software handles this automatically. Most tax preparation software pulls the box 12 code W amount into Form 8889 Line 9 when you enter your W-2. Do not enter amounts from your W-2 separately in the HSA contribution section.
If you made no contributions outside of payroll, your completed Form 8889 should show Line 2 as $0, Line 9 as your full Code W amount, and Line 13 as $0.
Code W and the Double-Counting Trap
Tax professionals see this mistake hundreds of times each filing season. Here is exactly how it happens:
You see $3,600 in your HSA account. You know you contributed that money from your paychecks. When your tax software asks "Did you make any HSA contributions?" you answer yes and enter $3,600 on Line 2. But that same $3,600 is already on Line 9 from your W-2. Now you have reported $7,200 in contributions when you actually made $3,600.
For 2025, the maximum contribution is $4,300 for self-only coverage and $8,550 for family coverage. Double-counting could make it appear you have exceeded these limits, triggering a 6% excise tax on the excess amount.
Important
The 6% penalty recurs annually. The excise tax applies each year the excess remains in your account. You must file Form 5329 to report it, and earnings on the excess get hit with income tax plus a 20% penalty if you are under 65.
Real-world example: Sarah has self-only coverage. She contributed $3,600 through payroll and her employer added $600, bringing her Code W total to $4,200. She mistakenly enters $3,600 on Line 2 while Line 9 shows $4,200. Her Form 8889 now shows $7,800 - exceeding the $4,300 limit by $3,500. She faces a $210 penalty for 2025, recurring every year until corrected.
The fix is simple: Sarah enters $0 on Line 2 and lets Line 9 show $4,200. No double-counting, no penalty.
The IRS has strengthened automated cross-referencing between employer Box 12 reporting and individual tax returns. Double-counting errors are more likely to be caught than in previous years.
How to Verify Your Code W Amount Is Correct
Not all employers get this right. Payroll errors happen, and catching them before you file saves considerable hassle. Here are three ways to verify:
Check your final pay stub. Your last pay stub of 2025 should show year-to-date HSA deductions. Add any employer contributions to get your expected Code W total.
Review your HSA provider statements. Log into your HSA account and look for the annual contribution summary. Most providers break down contributions by source - employer, payroll deduction, and direct.
Compare to Form 5498-SA. Your HSA administrator is not required to send this until May, but most providers show contribution totals in your online account before then.
Good to Know
Form 5498-SA reports the market value of your HSA at year-end, total contributions within the calendar year, and contributions for the tax year through the filing deadline. Use it to verify your W-2 matches reality.
Common errors to watch for:
- Employer left out their own contributions (Code W shows only your payroll deductions, not both)
- Employer left out your payroll contributions (you contributed via payroll but Box 12 is missing Code W entirely)
- Employer included health insurance premiums in the Code W amount
- Prior-year contributions appearing on the current W-2, making Code W look higher than the annual limit
If you spot a discrepancy, document it with pay stubs and HSA statements before contacting your employer's HR or payroll department. You can also check your HSA-eligible expenses while you are reviewing your account.
What to Do If Code W Is Wrong or Missing
If your W-2 has an error, you have two options.
Request a corrected W-2 (Form W-2c). Contact HR or payroll with your documentation - pay stubs showing HSA deductions and your HSA provider's contribution statement. Explain that IRS guidelines require Box 12 Code W to include both employer and employee payroll contributions.
File without the correction. If you cannot get a corrected W-2 before the filing deadline, you can report the correct amounts directly on Form 8889 in your tax software. Keep all documentation in case the IRS sends a notice about the mismatch.
Important
Keep your records. The IRS may send a notice if your Form 8889 does not match your W-2. Having pay stubs and provider statements ready makes resolving any questions straightforward.
If your W-2 overstates contributions, enter what is actually on your W-2 and note the discrepancy. Pursuing a corrected W-2 is still the best approach to avoid future questions.
For a complete walkthrough of every line on Form 8889, see our Form 8889 guide.
Frequently Asked Questions
Q: If I contributed through payroll deduction, do I get to deduct it on my tax return?
No additional deduction is needed. Your payroll contributions were pre-tax, so they were never included in your taxable wages (Box 1). The tax benefit already happened. Line 13 on Form 8889 only covers after-tax contributions.
Q: What is the benefit of contributing through payroll versus direct contributions?
Payroll deductions save you the 7.65% FICA tax on top of income tax. Direct contributions only get you the income tax deduction. On a $4,300 contribution, payroll saves you an extra $329.
Q: Can box 12 code W be higher than the annual contribution limit?
Yes. If your employer made prior-year contributions in January, those appear on the current W-2. As long as the excess is attributable to prior-year contributions made before the filing deadline, this is not a problem.
Q: What if I have two W-2s with box 12 code W amounts?
Add both amounts together for Form 8889 Line 9. Make sure the combined total does not exceed $4,300 (self-only) or $8,550 (family) for 2025, plus $1,000 catch-up if you are 55 or older.
Q: My HSA provider statement shows a different total than my W-2. Which is right?
Your W-2 Code W should match the "employer contributions" on your provider statement. If your provider also shows "direct contributions," those would not appear on your W-2 - report them separately on Form 8889 Line 2.
Written by
David is a licensed attorney and SHRM Senior Certified Professional who covers HSA compliance, IRS regulations, and employer benefits law. He previously practiced employee benefits law at a national firm.