Back to Methodology

Social Security Optimizer: Technical Whitepaper

Executive Summary

The Social Security Optimizer helps users find their optimal claiming strategy by exhaustively testing all valid claiming age combinations through Monte Carlo simulation. Rather than relying on simple breakeven calculations, it evaluates each strategy's impact on lifetime taxes, portfolio survival probability, and ending wealth—producing a ranked list of the top 5 strategies.

The Problem

Choosing when to claim Social Security is one of the most consequential retirement decisions:

  • Claiming at 62 reduces benefits by ~30% permanently
  • Claiming at 70 increases benefits by ~24% over Full Retirement Age (FRA)
  • For couples, the decision space explodes: 81 possible combinations (9 ages × 9 ages)

Traditional advice focuses on breakeven analysis: "If you live past 78, delaying was worth it." But this ignores:

  1. Tax interactions — Higher SS income may push you into higher tax brackets
  2. Roth conversion opportunities — Delayed SS creates a low-income window for conversions
  3. Sequence of returns risk — Early claiming provides income during vulnerable early retirement years
  4. IRMAA thresholds — SS income affects Medicare premium surcharges
  5. ACA subsidies — For early retirees, SS income affects healthcare subsidies
  6. Survivor benefits (couples) — When one spouse dies, the survivor keeps only the higher of the two benefits. For couples with unequal earnings, the higher earner's claiming age often matters more than their own—it determines the survivor's income for potentially decades. This single factor frequently dominates the optimal strategy for couples, yet breakeven analysis ignores it entirely.

The optimizer evaluates all these factors simultaneously.

Architecture Overview

┌─────────────────────────────────────────────────────────────────┐
│                    User Inputs                                   │
│  • Primary PIA (benefit at FRA)                                 │
│  • Spouse PIA (if applicable)                                   │
│  • Birth dates                                                   │
│  • Life expectancies                                            │
│  • Portfolio balances                                           │
└───────────────────────┬─────────────────────────────────────────┘
                        ▼
┌─────────────────────────────────────────────────────────────────┐
│              Phase 1: Screening (Quick Evaluation)              │
│  • Generate all valid claiming combinations                     │
│  • Singles: 9 combinations (ages 62-70)                         │
│  • Couples: 81 combinations (9 × 9)                             │
│  • Run 75 Monte Carlo trials per combination                    │
│  • Calculate weighted score for each                            │
│  • Select top 5 by score                                        │
└───────────────────────┬─────────────────────────────────────────┘
                        ▼
┌─────────────────────────────────────────────────────────────────┐
│              Phase 2: Refinement (Accurate Evaluation)          │
│  • Re-evaluate top 5 with 300 Monte Carlo trials                │
│  • Include reference strategy (FRA or Balanced)                 │
│  • Re-rank with refined scores                                  │
│  • Calculate deltas vs. reference                               │
└───────────────────────┬─────────────────────────────────────────┘
                        ▼
┌─────────────────────────────────────────────────────────────────┐
│                    Results Display                               │
│  • Top 5 strategies ranked by score                             │
│  • Metrics: success rate, lifetime taxes, ending balance        │
│  • Deltas shown vs. reference strategy                          │
│  • Custom strategy evaluation via sliders                       │
└─────────────────────────────────────────────────────────────────┘

Key Files

FilePurpose
src/lib/analysis/ssStrategyComparison.tsCore optimizer: exhaustive search, scoring, ranking
src/lib/ss/strategyGenerator.tsStrategy definitions, benefit derivation
src/lib/ss/benefitCalculator.tsSSA rules: FRA, reduction/credit formulas
src/lib/ss/recommendationEngine.tsInitial recommendation heuristics
src/components/calculator/SSStrategySelector.tsxUI component

Strategy Options

Singles (4 preset strategies)

StrategyClaiming AgeRationale
Early62Maximize years of income; lower monthly amount
FRA66-67Balanced approach; full unreduced benefit
Delayed70Maximize monthly benefit (+8%/year delayed credits)
Custom62-70User-defined via slider

Couples (5 preset strategies)

StrategyPrimarySpouseRationale
Maximize Survivor7062Higher earner delays to maximize survivor benefit
BalancedFRAFRABoth claim at full retirement age
Early Income6262Maximum early cash flow
Maximum Benefit7070Both delay for maximum benefits
Custom62-7062-70User-defined via dual sliders

Evaluation Pipeline

For each claiming age combination, the optimizer runs this pipeline:

Step 1: Derive SS Benefits

deriveSSBenefitsFromStrategy(inputs, strategy) → {
  primarySSAmount: number,    // Annual benefit in today's dollars
  primarySSAge: number,       // Claiming age
  spouseSSAmount?: number,    // Spouse annual benefit
  spouseSSAge?: number        // Spouse claiming age
}

The SSA benefit formulas are applied:

  • Before FRA: Reduce by 5/9 of 1% per month for first 36 months, then 5/12 of 1% per month
  • After FRA: Increase by 8% per year (2/3 of 1% per month) up to age 70

Step 2: Run Roth Optimizer

Each SS strategy creates different income patterns, which affect optimal Roth conversions:

optimizeRothConversions({
  ...inputs,
  socialSecurityAmount: derivedPrimaryAmount,
  socialSecurityAge: derivedPrimaryAge,
  // ... spouse amounts if applicable
}) → {
  conversions: { [age: number]: number },
  taxSavings: number
}

Key insight: Delayed SS claiming creates a low-income window (between retirement and SS start) that's ideal for Roth conversions at lower tax brackets.

Step 3: Run Monte Carlo Simulation

runMonteCarloSimulation({
  inputs,
  optimizerResults,
  numTrials: 75 | 300,
  seed: deterministicSeed
}) → {
  successRate: number,        // % of trials where portfolio lasted
  medianEndingBalance: number,
  statistics: { ... }
}

The simulation uses 99 years of historical market data (1926-2024), testing how each strategy performs across different sequence-of-returns scenarios.

Step 4: Calculate Score

calculateStrategyScore(result, allResults, weights) → number  // 0-1

Each metric is normalized to the 0-1 range across all tested strategies, then combined with weights.

Scoring System

Dynamic Weighting

The optimizer uses different weights depending on whether any strategy has concerning success rates:

Standard Weights (when any strategy ≤ 90% success):

MetricWeightRationale
Success Rate50%Safety is paramount when failure is possible
Lifetime Taxes30%Tax savings matter but secondary to survival
Ending Balance20%Legacy is nice-to-have

High Success Weights (when all strategies > 90% success):

MetricWeightRationale
Success Rate30%Less differentiation when all are safe
Lifetime Taxes40%Primary focus shifts to tax optimization
Ending Balance30%More weight to wealth accumulation

Score Calculation

// Normalize each metric to 0-1 range
successNorm = (result.successRate - minSuccess) / (maxSuccess - minSuccess)
taxesNorm = (maxTaxes - result.taxes) / (maxTaxes - minTaxes)  // Inverted: lower is better
balanceNorm = (result.balance - minBalance) / (maxBalance - minBalance)

// Weighted combination
score = (successNorm × successWeight) +
        (taxesNorm × taxesWeight) +
        (balanceNorm × balanceWeight)

Interpreting Scores

"Why should a 1% success rate difference outweigh $200k in taxes?"

Because the outcomes are asymmetric:

  • Running out of money is catastrophic and irreversible. You can't un-retire. You can't reclaim decades of spending. The downside is unbounded misery.
  • Paying extra taxes is suboptimal but survivable. You have less wealth, but you still have wealth. The downside is bounded.

This asymmetry justifies weighting success rate heavily when failure is plausible. A strategy that's 92% safe vs 88% safe isn't "4% better"—it's the difference between "probably fine" and "meaningful chance of disaster."

Why normalize across strategies instead of using absolute values?

The score answers: "Which of these options is best for you?" not "How good is this strategy in absolute terms?"

If all your strategies cluster between 94-97% success, the optimizer focuses on taxes and wealth (where there's real differentiation). If they span 75-95%, success rate dominates (as it should). Normalization makes the score contextually relevant.

What does a 0.05 score difference mean?

Small score differences (< 0.03) indicate strategies are effectively equivalent—pick based on preference or simplicity. Larger differences (> 0.10) indicate one strategy is meaningfully better across the weighted factors.

Why does the 90% threshold exist?

It encodes a simple heuristic: "Once every strategy is safe enough, stop optimizing for safety." The threshold is deliberately conservative—90% means 1-in-10 historical scenarios failed, which is still concerning. Below 90%, safety dominates. Above 90%, the optimizer pivots to tax and wealth optimization.

This could be more sophisticated (percentile-based gating, nonlinear weighting), but the binary threshold is transparent and predictable. Users can see exactly when the weights shift.

Two-Phase Evaluation

Why Two Phases?

Testing 81 combinations × 300 trials × full projection = slow. The two-phase approach balances speed and accuracy:

Phase 1 (Screening):

  • 75 trials per combination
  • Tests ALL combinations (9 or 81)
  • Identifies top 5 candidates
  • Total: ~6,075 trials for couples

Phase 2 (Refinement):

  • 300 trials per combination
  • Only top 5 + reference (6 strategies)
  • More accurate final ranking
  • Total: ~1,800 trials

This reduces computation by ~4x while maintaining accuracy for the strategies that matter.

Reference Strategy

The reference strategy anchors the comparison:

  • Singles: FRA (age 67)
  • Couples: Balanced (both at 67)

All deltas in the UI are shown relative to this baseline, making it easy to see if a strategy is better or worse than the "default" choice.

Couple-Specific Considerations

Survivor Benefits

For couples, the optimizer models survivor benefits according to SSA rules:

When either spouse dies, the survivor receives the higher of:

  • Their own current benefit, OR
  • The deceased spouse's benefit (at the amount the deceased was receiving)

This is why the higher earner's claiming age is often the most important decision for couples—it determines the survivor's income for potentially decades after the first death.

Earnings Gap Patterns

The optimizer tests all 81 combinations without heuristic bias—it doesn't pre-filter based on earnings gap. However, results tend to follow predictable patterns:

  • Large gap (one earner has >40% higher PIA): "Maximize Survivor" strategies often rank highest
  • Small gap (<20% difference): Balanced strategies tend to perform well
  • Equal earners: "Maximum Benefit" (both delay to 70) frequently outperforms

These are observed patterns, not algorithmic shortcuts. The optimizer evaluates every combination and lets the scoring system surface the winners.

End-of-Plan Age

For couples, the plan runs until the later of:

  • Primary's life expectancy
  • Spouse's life expectancy

This ensures the survivor period is properly modeled.

Constants Reference

// Claiming ages
SS_EARLIEST_CLAIMING_AGE = 62
SS_LATEST_CLAIMING_AGE = 70

// Monte Carlo trials
SS_COMPARISON_SCREENING_TRIALS = 75
SS_COMPARISON_REFINEMENT_TRIALS = 300
SS_COMPARISON_TOP_N = 5

// Scoring weights (standard)
SS_COMPARISON_SCORE_WEIGHTS = { success: 0.5, taxes: 0.3, balance: 0.2 }

// Scoring weights (high success)
SS_COMPARISON_HIGH_SUCCESS_WEIGHTS = { success: 0.3, taxes: 0.4, balance: 0.3 }
SS_COMPARISON_HIGH_SUCCESS_THRESHOLD = 0.9

// SSA benefit adjustments
SS_EARLY_REDUCTION_FIRST_36_MONTHS = 5/9 of 1% per month  // 6.67%/year
SS_EARLY_REDUCTION_AFTER_36_MONTHS = 5/12 of 1% per month // 5%/year
SS_DELAYED_CREDIT_RATE = 8% per year                      // 2/3 of 1% per month

// Traditional breakeven ages
SS_BREAKEVEN_62_VS_67 ≈ 78
SS_BREAKEVEN_67_VS_70 ≈ 82

Custom Strategy Evaluation

When users adjust the custom sliders, the optimizer:

  1. Debounces input (500ms) to avoid excessive computation
  2. Runs single-strategy evaluation with 300 trials
  3. Updates the comparison table with the custom row
  4. Shows deltas vs. reference strategy

This enables real-time "what-if" exploration without re-running the full comparison.

Deterministic Results

The optimizer uses seeded random number generation:

seed = hash(inputs) + strategyIndex

This ensures:

  • Same inputs → same results (reproducible)
  • Different strategies get different sequences (fair comparison)
  • Results can be cached and compared

Key Assumptions

The optimizer relies on several modeling assumptions. Understanding these helps interpret results correctly.

Lifetime Taxes Definition

"Lifetime taxes" is the sum of five components for each projection year:

totalTax = federalTax + stateTax + capitalGainsTax + niitTax + irmaaSurcharge
ComponentDescription
Federal Income TaxProgressive brackets on ordinary income
State Income TaxState-specific rates with retirement exemptions
Capital Gains TaxLong-term gains at 0%/15%/20%, stacked on ordinary income
NIIT3.8% Net Investment Income Tax for high earners
IRMAAMedicare premium surcharges (ages 65+)

Important: Displayed values are inflation-adjusted to "today's dollars" but NOT discounted for time value of money. This is a sum, not a net present value. For ranking strategies against each other, this is appropriate—all strategies use the same methodology.

Investment Returns (Monte Carlo)

Monte Carlo simulation uses historical bootstrap with block stitching:

  • Data source: 99 years of S&P 500 and 10-year Treasury returns (1926-2024)
  • Method: Randomly samples 3-7 year blocks of consecutive historical years, chains them together
  • Why blocks: Preserves short-term market patterns (bull/bear runs) while mixing economic eras
  • Returns are nominal: Inflation is tracked separately and applied to expenses/brackets

The deterministic calculator uses user-configured returns (default 7% stocks, 4% bonds). Monte Carlo ignores these and uses actual historical data.

Social Security COLA

SS benefits are modeled with simplified COLA based on the user's general inflation assumption:

  • Benefits input as annual amount at claiming age
  • Compounded by user's inflation rate each year (default 3%)
  • This differs from actual SSA rules (CPI-W-indexed, announced annually)

For planning purposes, this is reasonable—it assumes SS maintains purchasing power, which has historically been true.

Mortality

Life expectancy is a fixed user input, not stochastic. The simulation does not model longevity risk probabilistically—all trials use the same death age.

This is a simplification. In reality, living longer than expected is a key retirement risk. Users should consider setting life expectancy conservatively (e.g., 95) to stress-test their plan.

Tax Law Versioning

ComponentBase YearInflation-Indexed?
Federal tax brackets2025Yes (user's inflation rate)
Standard deduction2025Yes
Capital gains brackets2025Yes
IRMAA thresholds2025Yes
SS taxability thresholds1984/1993No (matches real law)
NIIT threshold2013No (matches real law)

The non-indexed SS and NIIT thresholds are intentional—they match actual IRS rules where these thresholds have never been adjusted for inflation.

Limitations

Spousal Benefits Not Modeled

The optimizer assumes each spouse claims on their own work record. It does not model spousal benefits (claiming up to 50% of the higher earner's PIA).

Who this affects: Lower-earning spouses in traditional single-earner or highly unequal-earner marriages. Specifically: if your own PIA is less than 50% of your spouse's PIA, you may be entitled to a spousal benefit that exceeds your own. The optimizer won't find this.

Who this doesn't affect: Dual-income couples where both spouses have substantial work histories. If both PIAs are within 2x of each other, spousal benefits are irrelevant—you'll claim on your own record regardless.

Why it's not modeled (yet): Spousal benefit rules interact with claiming age in non-obvious ways, and the "deemed filing" rules (post-2015) eliminated most strategic flexibility. For the majority of users, own-record claiming is optimal. This is a known gap we intend to address.

Other Limitations

  1. Divorced spouse benefits not modeled — Benefits available to divorced spouses after 10+ year marriages are not considered. Affects: divorced individuals who were married 10+ years and haven't remarried.

  2. Survivor claiming optimization not modeled — The optimizer doesn't consider delaying survivor benefits (available at age 60) separately from retirement benefits. Survivor benefits are modeled for projection purposes, but not optimized as a separate claiming decision.

  3. Government Pension Offset (GPO) not modeled — Affects: those with government pensions from employment not covered by Social Security (some state/local government workers, federal employees hired before 1984).

  4. Windfall Elimination Provision (WEP) not modeled — Affects: those who earned pensions from non-SS-covered employment AND have SS benefits from other covered work. WEP can reduce SS benefits by several hundred dollars per month (the maximum reduction is indexed annually).

Future Enhancements

Potential improvements under consideration:

  1. Spousal benefit modeling — Allow claiming spousal benefits when advantageous
  2. Restricted application strategies — For those born before 1954 (grandfathered)
  3. Breakeven visualization — Show when each strategy overtakes others
  4. Sensitivity analysis — How results change with different life expectancies
  5. Tax bracket visualization — Show which brackets each strategy uses

Conclusion

The Social Security Optimizer transforms a complex, multi-dimensional decision into a clear ranking of options. By integrating SS claiming with Roth conversions and Monte Carlo simulation, it captures interactions that simple breakeven calculators miss.

The two-phase approach balances computational efficiency with accuracy, while the dynamic weighting system adapts to each user's risk profile. The result is personalized, holistic guidance for one of retirement's most important decisions.

Optimize your own claiming strategy

Run the Social Security optimizer on your own numbers. Private by default — all modeling runs in your browser.

Open Optimizer