researchAudience: general6 min read

How to Calculate AGI and MAGI (Step-by-Step Guide)

Learn how to calculate your adjusted gross income (AGI) and modified adjusted gross income (MAGI) with step-by-step examples at different income levels.

To calculate your AGI, add up all income (wages, investments, retirement distributions) and subtract above-the-line deductions like IRA contributions and student loan interest. Your MAGI starts with AGI and adds back specific deductions depending on the tax benefit in question. Below is a step-by-step walkthrough with examples at different income levels.

Key Takeaways

  • AGI = Total Income minus above-the-line deductions (Form 1040, Line 11).
  • MAGI = AGI plus certain add-backs -- the exact add-backs depend on the tax benefit.
  • For most W-2 employees, AGI and MAGI are the same number.
  • MAGI controls Roth IRA eligibility, education credits, Medicare premiums, and more.

How to Calculate AGI (Adjusted Gross Income)

AGI is your total income minus specific “above-the-line” deductions. Unlike itemized deductions, you claim these whether or not you take the standard deduction.

Step 1: Add up all income sources

  • W-2 wages and salary
  • Self-employment income (Schedule C net profit)
  • Investment income: interest, dividends, capital gains
  • Rental income (Schedule E)
  • Retirement distributions (401(k), IRA, pension)
  • Unemployment compensation
  • Social Security benefits (taxable portion)
  • DoorDash and gig income (Schedule C)

Step 2: Subtract above-the-line deductions

  • Traditional IRA contributions (if deductible)
  • HSA contributions (up to $4,300 self-only / $8,550 family for 2025; $4,400 / $8,750 for 2026)
  • Student loan interest (up to $2,500)
  • Self-employment tax deduction (50% of SE tax)
  • Self-employed health insurance premiums
  • Educator expenses (up to $300)

The result is your AGI – it appears on Form 1040, Line 11.

How to Calculate MAGI (Modified Adjusted Gross Income)

MAGI starts with your AGI and adds back certain deductions. The key detail most people miss: the add-backs are different depending on which tax benefit you are evaluating.

MAGI for Roth IRA Eligibility

Start with AGI, then add back:

  • Traditional IRA deduction
  • Student loan interest deduction
  • Foreign earned income exclusion
  • Foreign housing exclusion

For most domestic W-2 earners, none of these apply – so MAGI = AGI. See our AGI vs. MAGI glossary entry for more detail.

MAGI for the Net Investment Income Tax (NIIT)

For the 3.8% NIIT surtax, MAGI equals AGI plus the net foreign earned income exclusion. The NIIT threshold is $200,000 (single) or $250,000 (married filing jointly).

MAGI for Medicare Premium Surcharges (IRMAA)

Medicare uses MAGI from two years prior to set Part B and Part D surcharges. MAGI for IRMAA equals AGI plus tax-exempt interest income (e.g., municipal bond interest).

MAGI for Education Credits

For the American Opportunity and Lifetime Learning credits, MAGI = AGI plus foreign earned income exclusion, foreign housing exclusion, and income from Puerto Rico or American Samoa.

Roth IRA Income Limits (MAGI-Based)

Your MAGI determines how much you can contribute directly to a Roth IRA. If your MAGI exceeds the limit, a backdoor Roth is still available.

Filing Status20252026
Single -- Full ContributionUnder $150,000Under $153,000
Single -- Phase-Out Range$150,000 - $165,000$153,000 - $168,000
Single -- No Direct ContributionAbove $165,000Above $168,000
MFJ -- Full ContributionUnder $236,000Under $242,000
MFJ -- Phase-Out Range$236,000 - $246,000$242,000 - $252,000
MFJ -- No Direct ContributionAbove $246,000Above $252,000

If your MAGI falls in the phase-out range, you can contribute a reduced amount. Above the top end, the direct contribution limit drops to zero – but you can still use the backdoor Roth IRA strategy.

Worked Examples

Example 1: W-2 Employee, Single Filer

Line Item Amount
W-2 wages $85,000
Bank interest $500
Total income $85,500
Student loan interest deduction -$2,500
AGI $83,000
Add back: student loan interest +$2,500
MAGI (for Roth IRA) $85,500

This person’s AGI is $83,000 but their MAGI for Roth IRA purposes is $85,500. Both are well below the single-filer phase-out, so they can make a full Roth IRA contribution of $7,000 (2025) or $7,500 (2026).

Example 2: Self-Employed, Married Filing Jointly

Line Item Amount
Spouse 1 – W-2 wages $120,000
Spouse 2 – Schedule C net profit $90,000
Investment dividends $5,000
Total income $215,000
Self-employment tax deduction (50%) -$6,362
SEP IRA contribution -$18,000
Self-employed health insurance -$8,400
AGI $182,238
MAGI (for Roth IRA) $182,238

No Roth IRA add-backs apply here (SEP IRA deductions are not added back for Roth MAGI), so MAGI equals AGI. This couple is well within the MFJ phase-out range and can make full Roth IRA contributions.

Example 3: High-Income Earner Near the Phase-Out

Line Item Amount
W-2 wages $155,000
RSU income $12,000
Total income $167,000
Traditional IRA deduction $0 (income too high)
AGI / MAGI $167,000

This single filer’s MAGI of $167,000 falls within the 2026 phase-out range ($153,000 - $168,000), meaning their direct Roth contribution is reduced. They should consider the backdoor Roth for a full contribution instead.

Why AGI and MAGI Matter Beyond Roth IRAs

Your AGI and MAGI affect many parts of the tax code:

  • Standard deduction vs. itemizing – AGI determines the threshold for medical expense deductions (7.5% of AGI) and charitable contribution limits (60% of AGI for cash)
  • Earned income tax credit – AGI-based income limits
  • Child tax credit – MAGI-based phase-out starts at $200,000 (single) / $400,000 (MFJ)
  • Education credits – MAGI-based limits for AOTC and LLC
  • Traditional IRA deductibility – MAGI determines if your contribution is deductible when covered by a workplace plan
  • Medicare IRMAA surcharges – MAGI from two years prior sets your Part B/D premiums
  • Net investment income tax – 3.8% surtax triggered by MAGI above $200k/$250k

How sharper.tax Helps

sharper.tax reads your AGI directly from your uploaded return and automatically calculates the relevant MAGI for every strategy – Roth IRA eligibility, Traditional IRA deductibility, NIIT exposure, and more. You never have to compute MAGI by hand. The same analysis a high-end CPA performs is now available for free.

Sources

The information above is educational and not tax advice.