HSA Contributions on Your W-2: Code W, Form 8889, and Limits

The number in Box 12 of your W-2 labeled Code W is the total of HSA contributions that moved through your employer’s payroll system during the year. It combines two things into one figure: money your employer put into your health savings account on your behalf, and pre-tax dollars you elected to have withheld from your paychecks under a Section 125 cafeteria plan.1Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans You’ll carry that number to Form 8889 when you file, but you won’t deduct it again, because it has already been left out of your taxable wages.

What Code W Bundles Together

Your W-2 does not break the Code W figure into pieces. Whatever your employer contributed as a flat benefit and whatever you routed from your own pay through payroll deductions arrive as a single combined amount. That is the figure the IRS expects to see on your return.

Because these dollars are handled pre-tax through payroll, they never appear in your taxable wages to begin with. The Code W amount is already excluded from Box 1 (wages and compensation), Box 3 (Social Security wages), and Box 5 (Medicare wages).1Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans Your withholding was calculated on wages that already had these contributions taken out. You do not deduct the Code W amount again on your return.

Why Payroll Contributions Save More Than Income Tax

Pre-tax HSA contributions routed through payroll skip Social Security tax (6.2%) and Medicare tax (1.45%) in addition to federal income tax.2Internal Revenue Service. Topic No. 751, Social Security and Medicare Withholding Rates That is an extra 7.65% you cannot recover any other way. Contributions you make later from a personal bank account still get a federal income tax deduction, but you have already paid FICA on those dollars and there is no mechanism to claw it back. If your employer offers an HSA deduction option through payroll, using it is worth more than making the same contribution yourself.

Contributions That Won’t Show Up in Code W

Money you send to your HSA directly, by check or bank transfer, does not appear anywhere on your W-2. Your employer has no way to know about it. You claim those contributions on Line 2 of IRS Form 8889, and the deduction flows to Schedule 1 of your Form 1040, reducing your adjusted gross income.3Internal Revenue Service. Instructions for Form 8889 (2025)

You have until the federal filing deadline to make direct contributions for the prior tax year. Contributions made by April 15, 2026, still count toward 2025.1Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans Keep your own records of what you sent and when, because the W-2 will not reflect any of it.

How Code W Moves to Form 8889

Anyone who contributed to an HSA, received employer contributions, or took a distribution must file Form 8889 with their return. The Code W amount goes on Line 9 of Form 8889, which is the line for employer contributions, including your own payroll deductions routed through a cafeteria plan.3Internal Revenue Service. Instructions for Form 8889 (2025)

Direct contributions from a personal account go on Line 2. The instructions are explicit that Line 2 should not include employer or payroll contributions, and should not include rollovers from another HSA.3Internal Revenue Service. Instructions for Form 8889 (2025) Form 8889 then measures your total contributions against your annual limit and produces a deduction on Line 13, which carries to Schedule 1 (Form 1040), Line 13.4Internal Revenue Service. Instructions for Form 8889 (2025) The deduction reflects only your direct contributions, since the payroll amount has already been excluded from wages.

Your HSA custodian will also send you Form 5498-SA, which confirms the total contributions the account received during the year.5Internal Revenue Service. About Form 5498-SA, HSA, Archer MSA, or Medicare Advantage MSA Information You don’t file it with your return, but the total on Form 5498-SA should equal your Code W amount plus any direct contributions you made. If they don’t reconcile, something was recorded incorrectly.

Checking Code W Against the Annual Limit

The Code W figure plus any direct contributions cannot exceed the annual HSA limit. Excess contributions are hit with a 6% excise tax every year the money stays in the account.1Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans The tax keeps recurring until you fix it.

To avoid the penalty, withdraw the excess and any earnings on it before the filing deadline for that year’s return, including extensions.1Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans The earnings you pull out are taxable in the year the contribution was made. If you filed on time and only later realized you were over, you still have six months from your original filing deadline (extensions aside) to withdraw the excess and file an amended return.3Internal Revenue Service. Instructions for Form 8889 (2025)

This trips people up most often after a mid-year job change, when two employers both contribute and neither knows about the other. Add up the Code W amounts from every W-2 you received, add any direct contributions, and compare the total to your annual limit before you file.

When the Code W Number Looks Wrong

Compare Code W to your own pay stubs and to the year-end statement from your HSA custodian. If the numbers don’t line up, start with your employer’s payroll or HR department. Employers correct W-2 errors by issuing Form W-2c (Corrected Wage and Tax Statement).6Internal Revenue Service. General Instructions for Forms W-2 and W-3 If the original hasn’t gone to the Social Security Administration yet, they can void it and reissue. If it has, they file the W-2c with the SSA and give you a copy.

If the employer won’t act, the IRS can pressure them. After the end of February, call 800-829-1040 to file a W-2 complaint. The IRS sends the employer a letter demanding a corrected form within ten days. If nothing arrives, you can file using Form 4852 as a substitute W-2, estimating your wages and withholding from your final pay stub.7Internal Revenue Service. W-2 – Additional, Incorrect, Lost, Non-Receipt, Omitted Using Form 4852 can slow your refund while the IRS verifies your figures, and if a corrected W-2 arrives later with different numbers, you’ll need to amend with Form 1040-X.

State Tax Treatment

Most states follow the federal treatment, so Code W is excluded from state taxable wages the same way it is from federal wages. California and New Jersey are the two exceptions. Both tax HSA contributions as regular income and tax any interest or investment gains inside the account. If you live in either state, your Code W amount lowers your federal taxable income but not your state taxable income, and your state withholding will not show the same savings the federal side does.