IRA Contribution Calculator Formula

Understand the math behind the ira contribution calculator. Each variable explained with a worked example.

Formulas Used

Maximum IRA Contribution

max_contribution = magi <= phase_out_start ? base_limit : (magi >= phase_out_end ? 0 : base_limit * (phase_out_end - magi) / phase_out_range)

Catch-Up Amount (50+)

catch_up = age >= 50 ? 1000 : 0

Variables

VariableDescriptionDefault
ageYour Age35
magiModified Adjusted Gross Income(USD)120000
filing_statusFiling Status (1=Single, 2=Married)1
base_limitDerived value= age >= 50 ? 8000 : 7000calculated
phase_out_startDerived value= filing_status == 1 ? 150000 : 236000calculated
phase_out_endDerived value= filing_status == 1 ? 165000 : 246000calculated
phase_out_rangeDerived value= phase_out_end - phase_out_startcalculated

How It Works

IRA Contribution Limits

The IRS sets annual IRA contribution limits that depend on your age and income. Roth IRA contributions phase out at higher incomes.

Phase-Out Ranges (2026 estimates)

  • Single: $150,000 − $165,000 MAGI
  • Married Filing Jointly: $236,000 − $246,000 MAGI
  • If your income is below the phase-out start, you can contribute the full amount. Above the end, you cannot contribute directly to a Roth IRA.

    Worked Example

    Age 35, single, $120,000 MAGI.

    age = 35magi = 120000filing_status = 1
    1. 01Base limit for under-50 = $7,000
    2. 02Single phase-out range: $150,000 − $165,000
    3. 03MAGI $120,000 is below $150,000
    4. 04Full contribution allowed: $7,000

    Ready to run the numbers?

    Open IRA Contribution Calculator