To calculate gross income from your W-2, start with the wages in Box 1 and add back any pre-tax money your employer withheld before that number was printed. The main add-backs are traditional 401(k) or 403(b) contributions, HSA contributions, and cafeteria-plan deductions like health insurance premiums or FSA amounts. If your only pre-tax deductions are retirement and HSA, Box 5 (Medicare wages) already includes them and gets you to roughly the same figure in one step.
The Three Boxes That Matter
Your W-2 shows wages in several places, and each box is calculated a little differently.
- Box 1 — Wages, tips, other compensation. This is the amount subject to federal income tax. Pre-tax deductions for 401(k) contributions, HSA deferrals, and cafeteria-plan health premiums have already been subtracted, so Box 1 is lower than what you actually earned.1Internal Revenue Service. 2026 General Instructions for Forms W-2 and W-3 – Section: Box 1
- Box 3 — Social Security wages. This adds pre-tax retirement deferrals back in, but it’s capped at $184,500 for 2026. If you earn above that, Box 3 stops being useful as a gross-income proxy.2Social Security Administration. Contribution and Benefit Base
- Box 5 — Medicare wages and tips. Same treatment as Box 3, but with no cap. For most people, Box 5 is the closest single number to true gross pay. It still excludes cafeteria-plan items like pre-tax health insurance premiums and FSA contributions.3Internal Revenue Service. 2026 General Instructions for Forms W-2 and W-3 – Section: Box 5
If your employer offers no pre-tax benefits at all and you earn under the Social Security wage base, Boxes 1, 3, and 5 will match. That number is your gross income and you’re done.
Box 12 Codes to Add Back
Box 12 uses letter codes to flag specific types of compensation. Some of those codes represent pre-tax dollars that came out of your paycheck before Box 1 was calculated. To rebuild gross income, you add these back:
- Code D — traditional (pre-tax) 401(k) elective deferrals. The 2026 employee limit is $24,500.4Internal Revenue Service. 401(k) Limit Increases to $24,500 for 2026, IRA Limit Increases to $7,500
- Code E — 403(b) elective deferrals, common for teachers, hospital staff, and nonprofit workers.
- Code G — government 457(b) elective deferrals.
- Code S — SIMPLE retirement plan deferrals.
- Code W — HSA contributions (both employer and employee, if made through payroll). The 2026 HSA limits are $4,400 for self-only coverage and $8,750 for family coverage.
These amounts were excluded from Box 1 but are already sitting inside Boxes 3 and 5.5Internal Revenue Service. 2026 General Instructions for Forms W-2 and W-3 – Section: Box 12
Codes You Should Not Add Back
Several Box 12 codes look similar but represent money that’s already included in Box 1. Adding them a second time inflates your income.
- Code AA — designated Roth 401(k) contributions. Roth deferrals are after-tax, so they’re already in Box 1.6Internal Revenue Service. 2026 General Instructions for Forms W-2 and W-3 – Section: Box 12 Code AA
- Code BB — Roth 403(b) contributions.
- Code EE — Roth government 457(b) contributions.
- Code C — taxable cost of group-term life insurance over $50,000.
- Code V — income from exercising nonstatutory stock options; the spread is already in Box 1.
- Code DD — total cost of employer-sponsored health coverage. Informational only; it doesn’t affect any wage box.
Pre-Tax Deductions That Don’t Appear in Box 12
Some pre-tax items reduce Box 1 but never show up as a Box 12 code. These include employee-paid medical, dental, and vision premiums under a Section 125 cafeteria plan, flexible spending account contributions, and pre-tax commuter or parking benefits. For 2026, qualified transportation benefits can exclude up to $340 per month for transit passes and $340 per month for qualified parking.7Internal Revenue Service. 2026 Publication 15-B – Section: Transportation (Commuting) Benefits These amounts come out of your pay before Box 1, and they’re also excluded from Boxes 3 and 5, so no single W-2 box captures them. You’ll have to pull them from your final pay stub’s year-to-date totals.
Step-by-Step Calculation
Two paths work, depending on how precise you need to be.
Quick Method: Use Box 5
If your only pre-tax benefits are a retirement plan and maybe an HSA, Box 5 is your gross income. For earners under the $184,500 Social Security wage cap, Box 3 gives the same answer. This is the fastest route and it’s accurate whenever cafeteria-plan health insurance, FSA, and commuter benefits aren’t in the picture.
Detailed Method: Box 1 Plus Add-Backs
- Write down the Box 1 amount.
- Look at Box 12. Add the dollar amounts next to codes D, E, G, S, and W, if any appear.
- Leave codes AA, BB, EE, C, V, and DD alone.
- Pull year-to-date totals from your final pay stub for pre-tax health, dental, vision, FSA, and commuter deductions. Add those.
- The total is your gross compensation from that employer.
A worked example: Box 1 shows $55,000. Code D shows $10,000 in 401(k) contributions. Your December pay stub shows $3,600 in year-to-date pre-tax health premiums. Gross income is $68,600.
Cross-Checking Against Your Final Pay Stub
The last pay stub of the year is the cleanest reference point. Its year-to-date gross pay is what you earned before anything was withheld. Subtract the year-to-date pre-tax deductions (retirement, health insurance, HSA, FSA, commuter) from that gross pay, and the result should be close to Box 1. If it isn’t, or if the pay-stub gross doesn’t match the number you built from the W-2, something is off and worth raising with payroll.
If You Had More Than One Employer
Run the calculation separately for each W-2 and add the results. Box 3 needs particular care with multiple jobs: each employer caps Box 3 at $184,500 independently, so combined Box 3 amounts across W-2s can exceed the annual Social Security wage base.2Social Security Administration. Contribution and Benefit Base Box 5 has no cap, so it stays reliable across multiple W-2s.3Internal Revenue Service. 2026 General Instructions for Forms W-2 and W-3 – Section: Box 5
W-2 Gross Income Is Not Your Total Gross Income
Federal law defines gross income as income from any source, not only wages.8Office of the Law Revision Counsel. 26 U.S. Code 61 – Gross Income Defined The W-2 captures compensation from one employer. Interest, dividends, freelance income on a 1099, rental income, capital gains, and retirement distributions belong in your total gross income but won’t show up on a W-2. When a lender or agency asks for your gross income, ask whether they mean W-2 wages or all income combined.
Adjusted gross income is a different figure again. AGI starts with total gross income from every source and then subtracts specific adjustments from Schedule 1 of Form 1040, such as deductible IRA contributions, student loan interest, educator expenses, and the deductible portion of self-employment taxes.9Internal Revenue Service. Definition of Adjusted Gross Income AGI is equal to or lower than gross income, never higher. Most lenders want gross income; many tax credits phase out based on AGI.
If Your W-2 Looks Wrong
A calculation is only as good as the numbers on the form. If Box 1, Box 3, or Box 5 doesn’t match what you’d expect from your pay stubs, start with your employer’s payroll department. Employers correct W-2 errors by issuing Form W-2c, which also updates your earnings record with the Social Security Administration.10Social Security Administration. Helpful Hints to Forms W-2c/W-3c Filing
If your employer won’t fix the error, or your W-2 hasn’t arrived by the end of February, call the IRS at 800-829-1040. Have your employer’s name and full address ready along with your Social Security number. The IRS will contact the employer and ask for a corrected form within ten days.11Internal Revenue Service. W-2 – Additional, Incorrect, Lost, Non-Receipt, Omitted If a corrected W-2 still isn’t in hand by filing time, Form 4852 works as a substitute; you estimate wages and withholding from your final pay stub.12Internal Revenue Service. Form 4852 – Substitute for Form W-2, Wage and Tax Statement If a real W-2 shows up later and the numbers differ from what you filed, amend the return with Form 1040-X.