401(k) Calculator Formula
Understand the math behind the 401(k) calculator. Each variable explained with a worked example.
Formulas Used
Projected 401(k) Balance
future_value = current_balance * pow(1 + r, years_to_retire) + total_annual * (pow(1 + r, years_to_retire) - 1) / rTotal Contributions
total_contributions = total_annual * years_to_retireInvestment Growth
total_growth = future_value - current_balance - total_contributionsTotal Employer Match
employer_total = employer_contribution * years_to_retireVariables
| Variable | Description | Default |
|---|---|---|
current_balance | Current Balance(USD) | 50000 |
annual_contribution | Annual Contribution(USD) | 19500 |
employer_match_pct | Employer Match(%) | 50 |
match_limit_pct | Match Limit (% of Salary)(%) | 6 |
salary | Annual Salary(USD) | 85000 |
annual_return | Expected Annual Return(%) | 7 |
years_to_retire | Years Until Retirement(years) | 25 |
r | Derived value= annual_return / 100 | calculated |
employer_contribution | Derived value= salary * match_limit_pct / 100 * employer_match_pct / 100 | calculated |
total_annual | Derived value= annual_contribution + employer_contribution | calculated |
How It Works
How the 401(k) Calculator Works
This calculator projects your retirement savings using compound growth on both your existing balance and future contributions.
Formula
FV = PV × (1 + r)^n + PMT × [(1 + r)^n − 1] / r
Where:
Employer match is calculated as: Salary × Match Limit % × Match Rate %.
Worked Example
$50,000 current balance, $19,500/yr contribution, 50% employer match up to 6% of an $85,000 salary, 7% return, 25 years.
- 01Employer match = $85,000 × 6% × 50% = $2,550/yr
- 02Total annual = $19,500 + $2,550 = $22,050
- 03Current balance growth = $50,000 × (1.07)^25 = $271,372
- 04Contribution growth = $22,050 × [(1.07)^25 − 1] / 0.07 = $1,393,751
- 05Projected balance = $271,372 + $1,393,751 = $1,665,123
Frequently Asked Questions
What is the 401(k) contribution limit?
For 2026, the employee contribution limit is $23,500 (under age 50) or $31,000 (age 50+). Employer matching contributions do not count toward this limit.
How does employer matching work?
A common match is 50% of your contributions up to 6% of salary. If you earn $85,000 and contribute at least 6% ($5,100), your employer adds $2,550. Always contribute enough to get the full match.
Should I use pre-tax or Roth 401(k)?
Pre-tax 401(k) reduces taxable income now but is taxed at withdrawal. Roth 401(k) uses after-tax dollars but grows and is withdrawn tax-free. Choose based on whether you expect higher taxes now or in retirement.
Learn More
Guide
Retirement Savings Guide
A comprehensive guide to retirement savings. Learn how much you need to retire, the best account types, contribution strategies, employer matching, and how to build a retirement plan at any age.
Ready to run the numbers?
Open 401(k) Calculator