Skip to content

Bullrun-Forever/401k-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

401(k) Calculator

Free, open-source 401(k) retirement calculator with employer matching and 2026 contribution limits.

Project your retirement savings with employer match, catch-up contributions, the new super catch-up for ages 60-63, and a complete year-by-year breakdown.

Live Demo License: MIT


Try the Full Version

Use the 401(k) Calculator on BullRun Forever Tools — includes interactive charts, scenario comparison, CSV export, and dark mode.


Features

  • 2026 401(k) contribution limits ($24,500 / $32,000 / $35,750)
  • Employer matching calculations (configurable match % and cap)
  • Catch-up contributions for ages 50+ ($7,500)
  • NEW: Super catch-up contributions for ages 60-63 ($11,250)
  • Year-by-year growth breakdown with employer match tracking
  • Tax savings estimation from pre-tax contributions
  • 30-year extended projection
  • Zero dependencies — pure JavaScript math

2026 401(k) Contribution Limits

Age Group Employee Limit Catch-Up Total
Under 50 $24,500 $24,500
50-59 $24,500 $7,500 $32,000
60-63 $24,500 $11,250 $35,750
64+ $24,500 $7,500 $32,000

The SECURE 2.0 Act introduced the super catch-up provision for ages 60-63, allowing an additional $11,250 on top of the base limit.

Total Annual Addition Limit (employee + employer): $71,000


Quick Start

npm install
npm run dev

Open http://localhost:5173 to use the calculator locally.


The Math

Core Calculation

The calculator models year-by-year 401(k) growth including employee contributions, employer matching, and compound returns:

For each year from current age to retirement age:
  1. Determine contribution limit based on age
  2. Calculate employee contribution (salary × contribution%, capped at limit)
  3. Calculate employer match (employee contribution × match%, capped at matchable salary)
  4. Add both contributions to balance
  5. Apply annual return: growth = balance × rate
  6. End-of-year balance = balance + growth

Employer Match Calculation

matchableAmount = annualSalary × (matchCap / 100)
employeeContributionForMatch = min(employeeContribution, matchableAmount)
employerMatch = employeeContributionForMatch × (matchPercent / 100)

Example: Salary $75,000, employer matches 50% up to 6% of salary:

Matchable Amount: $75,000 × 6% = $4,500
If employee contributes $4,500+:
  Employer Match: $4,500 × 50% = $2,250/year (FREE money!)

Full Example

Inputs:

  • Current Age: 30, Retirement Age: 65
  • Current Balance: $10,000
  • Annual Salary: $75,000
  • Contribution: 15% ($11,250/year)
  • Employer Match: 50% up to 6%
  • Expected Return: 8%

Year 1:

Employee Contribution: $11,250 (under $24,500 limit)
Employer Match: min($11,250, $4,500) × 50% = $2,250
Total Added: $13,500
Starting: $10,000 + $13,500 = $23,500
Growth: $23,500 × 8% = $1,880
Ending Balance: $25,380

After 35 years:

Total Value:           ~$2,847,000
Your Contributions:    ~$404,250
Employer Match:        ~$78,750
Investment Earnings:   ~$2,364,000
Est. Tax Savings:      ~$97,020 (at 24% bracket)

Key Formulas

Calculation Formula
Employee Contribution min(salary × contributionPct, ageLimit)
Employer Match min(employeeContrib, salary × matchCap) × matchPct
Annual Growth balance × (annualReturn / 100)
Tax Savings totalEmployeeContributions × marginalTaxRate
Total Earnings finalValue - employeeContributed - employerContributed
Contribution Limit Age-based: <50: $24,500 / 50-59: $32,000 / 60-63: $35,750 / 64+: $32,000

Usage (JavaScript)

import { calculate401k } from './src/calculator.js';

const result = calculate401k({
  currentAge: 30,
  retirementAge: 65,
  currentBalance: 10000,
  annualSalary: 75000,
  contributionPercent: 15,
  annualReturn: 8,
  employerMatchPercent: 50,
  employerMatchCap: 6
});

console.log(result.totalValue);              // ~$2,847,000
console.log(result.totalEmployerContributed); // ~$78,750
console.log(result.estimatedTaxSavings);      // ~$97,020
console.log(result.yearlyBreakdown);          // Array of yearly data

Output Object

{
  totalValue: number,               // Final 401(k) balance at retirement
  totalEmployeeContributed: number,  // Sum of your contributions
  totalEmployerContributed: number,  // Sum of employer match contributions
  totalContributions: number,        // Employee + employer total
  totalEarnings: number,             // Investment growth
  returnOnInvestment: number,        // ROI percentage
  estimatedTaxSavings: number,       // Tax savings from pre-tax contributions
  years: number,                     // Years until retirement
  yearlyBreakdown: [
    {
      year: number,
      age: number,
      startingBalance: number,
      employeeContribution: number,
      employerMatch: number,
      totalContribution: number,
      contributionLimit: number,
      growth: number,
      endingBalance: number,
      totalEmployeeContributed: number,
      totalEmployerContributed: number,
      totalEarnings: number
    }
  ],
  thirtyYearProjection: {            // Extended projection (if applicable)
    totalValue: number,
    totalEmployeeContributed: number,
    totalEmployerContributed: number,
    totalEarnings: number
  }
}

Why 401(k)?

The 401(k) is the most widely used retirement vehicle in America:

  • 70+ million Americans actively contribute (Investment Company Institute)
  • Employer matching — an instant 50-100% return on your contributions
  • Tax-deferred growth — investments compound without annual tax drag
  • Higher limits — $24,500 vs. $7,000 for IRAs
  • Automatic payroll deductions — set it and forget it
  • Average employer match: 4.7% of salary (Vanguard's How America Saves 2025)

An employee earning $60,000 who skips the match forfeits $2,820/year in free money.

Traditional vs Roth 401(k)

Feature Traditional 401(k) Roth 401(k)
Contributions Pre-tax (reduces taxable income) After-tax
Withdrawals Taxed as ordinary income Tax-free
Best if Lower tax bracket in retirement Higher tax bracket in retirement
RMDs Required at age 73 Required at 73 (can roll to Roth IRA)

FAQ

What are the 2026 401(k) contribution limits? $24,500 under 50, $32,000 for ages 50+, and $35,750 for ages 60-63 (super catch-up via SECURE 2.0 Act).

How does employer matching work? Your employer contributes based on your contributions. Common: 50% match up to 6% of salary. Always contribute enough to get the full match — it's free money.

What happens to my 401(k) if I change jobs? You can leave it, roll it to your new employer's plan, roll it into an IRA, or cash out (not recommended — 10% penalty + taxes).

How much should I contribute? Financial experts recommend 10-15% of gross income for retirement. At minimum, contribute enough for the full employer match.


More Free Financial Tools

This calculator is part of the BullRun Forever Toolkit — 16 free financial calculators including:


License

MIT License — use freely in your own projects.


Disclaimer

This calculator is for educational and informational purposes only. It is not financial, tax, or investment advice. Consult a qualified financial advisor for personalized recommendations. Tax laws and contribution limits may change.


Built by BullRun Forever
Free financial tools for everyone.

About

Free 401(k) retirement calculator with employer matching, 2026 contribution limits, catch-up contributions, and super catch-up for ages 60-63.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors