Skip to the content
Torsalis

Check the math

Every formula the planner uses, with worked examples that produce the exact numbers the tool shows. Open a spreadsheet, type these in, and you should land on the same figures to the dollar. If you don't, one of us has a bug — and we'd like to know.

The one convention to know: this year counts as the first compounding year. Today's values are treated as the balance at the start of the current year, and grow for a full year before anything else happens. Money you add during a year is added after that year's growth (it starts compounding next year). Spending in retirement is taken after that year's growth too.

1. Growth and contributions

Each holding compounds once a year at its own rate. Contributions land after growth.

closing = opening × (1 + rate) + (monthly contribution × 12)

Worked example. $100,000 in one fund at 10% a year, adding $1,000 a month:

YearOpeningGrowth (10%)AddedClosing
2026$100,000$10,000$12,000$122,000
2027$122,000$12,200$12,000$146,200
2028$146,200$14,620$12,000$172,820
2029$172,820$17,282$12,000$202,102

Which balance this is. The Closing column here is before tax — the market value, the figure a statement shows. The planner's table leads with the after-tax balance and carries this one beside it, labelled. With no account type set on this holding the two are the same; see section 13.

Spreadsheet: =B2*1.1+12000 down a column. If your sheet compounds monthly you will land a few percent higher — that is the difference between the two conventions, not an error.

2. Inflation and spending

You type spending in today's money. It compounds at your inflation rate from today, not from the retirement year, because prices don't wait for you to retire.

lifestyle cost in year Y = spend × (1 + inflation)^(Y − current year)

Worked example. $100,000 a year at 5% inflation, retiring in 2028 (two years from a 2026 start): 2028 costs $100,000 × 1.05² = $110,250; 2029 costs $115,763; 2030 costs $121,551.

3. Tax, simple mode

To put a dollar in your pocket you have to sell more than a dollar. One flat rate applies to every withdrawal.

gross sold = net needed ÷ (1 − rate) tax = gross − net

Worked example. $1,000,000 in a fund at 0% growth, 20% flat tax, spending as in section 2:

YearLifestyle costGross soldTaxNet spentClosing
2028$110,250$137,813$27,563$110,250$862,188
2029$115,763$144,703$28,941$115,763$717,484
2030$121,551$151,938$30,388$121,551$565,546

Check the first row: 110,250 ÷ 0.8 = 137,812.5. ✓

Which balance this is. Closing here is before tax. In Simple mode every dollar left is taxed at the same flat rate, so the after-tax balance the planner shows is this column × (1 − rate) — $565,546 becomes $452,437 at 20%. The planner shows both, labelled.

4. Tax, detailed mode (cost basis)

Each holding sits in an account. Roth withdrawals cost nothing. Pre-tax (401k/IRA) withdrawals are taxed in full at your income rate. Brokerage withdrawals are taxed only on the profit slice, at your capital-gains rate:

gain fraction = (value − cost basis) ÷ value effective rate = gain fraction × capital-gains rate gross sold = net needed ÷ (1 − effective rate)

Worked example. A $1,000,000 position you paid $400,000 for, 15% capital-gains rate, need $100,000 net: gain fraction = 600,000 ÷ 1,000,000 = 60%; effective rate = 60% × 15% = 9%; gross = 100,000 ÷ 0.91 = $109,890.11; tax = $9,890.11. ✓ matches the tool to the cent.

How basis is allocated. Torsalis takes one cost basis per holding, not a list of tax lots, so when you sell part of a position it allocates basis proportionally. Real tax depends on which shares you sell: the IRS default for stock is first-in-first-out unless you identify specific shares at the time of sale [3]. If you accumulated a position over years at different prices, that choice can move the number, and this model doesn't capture it.

Proportionally means the same fraction of your cost basis goes with the sale, so the gain fraction stays honest in later years. Money you contribute raises the basis in full — you already paid tax on it. Leave the basis blank and the projection treats today's price as your basis, so only future growth is taxed. The figure for selling today stays blank instead, because it depends entirely on what you paid.

4a. What to put in "Capital gains %"

The planner takes one combined rate, not a federal rate and a state rate on separate lines. That is deliberate: two fields imply the engine knows how they interact, and it does not. You do the addition, once, and you can see exactly what you added.

For most people selling a long-held position in a taxable account, the number is three things added together:

federal long-term capital gains 0%, 15% or 20% depending on income + net investment income tax 3.8% above the NIIT thresholds + your state's rate 0% in FL, TX, WA, NV, TN, SD, WY, AK, NH in CA, your ordinary-income rate [4] = what you type in Capital gains %

Worked example. A California resident whose marginal state rate is 9.3% — California has no separate capital-gains rate, so gains are taxed at whatever ordinary-income bracket you land in [4] — and whose income is high enough for the top federal band: 20% federal + 3.8% NIIT + 9.3% state = 33.1%. A Florida resident at the same income: 20% + 3.8% + 0% = 23.8%. Someone in the 15% federal band in Texas: 15% + 0% + 0% = 15%. Those are the three numbers you would type.

What this does not do: it does not move you between brackets as your income changes, and it does not model a state that taxes gains as ordinary income on a different schedule. If a sale is large enough to push you into a higher band partway through, the honest approach is to run it twice — once at each rate — and read the two answers as the range you are actually in.

Rates and the income thresholds they depend on are revised annually. This page deliberately publishes no dollar figures for them: the linked IRS pages [1][2] are the current authority, and a number copied here would be wrong the moment they change.

5. Sell order

Sell taxable first empties the brokerage account, then pre-tax, and leaves Roth for last. Pro-rata sells a slice of everything each year.

Worked example. $200,000 brokerage (no gain) + $800,000 Roth, spending $100,000 a year, no growth:

YearTaxable firstPro-rata
BrokerageRothBrokerageRoth
2027$100,000$800,000$180,000$720,000
2028$0$800,000$160,000$640,000
2029$0$700,000$140,000$560,000

Same holdings, same spending. The difference shows up as tax the moment either account has a gain. Measured across 126 plans — varying the split between the three account types, both tax rates and the cost basis — selling taxable first ends ahead after tax in all of them, by $105,000 to $1.13M on a $1.6M portfolio over thirty years. It is ahead because selling the brokerage account early realizes the gain while the gain is still a small share of what the holding is worth. Where every holding sits in one kind of account the two orders are identical, to the dollar.

Which balance this is. Brokerage with no gain owes nothing and Roth owes nothing, so here the before-tax and after-tax balances are identical. That makes this a clean illustration of the ordering and a poor one for the tax.

Compare after-tax figures, not balances: a dollar in a Roth and a dollar in a 401k are not worth the same, and a comparison of closing balances will favour whichever order leaves more money in the account that has not been taxed yet.

6. Price target → growth rate

rate = (target ÷ today's price)^(1 ÷ years) − 1 years = target year − current year + 1

Worked example. $197 today, target $575 by end of 2030 from 2026: 5 compounding years; (575 ÷ 197)^(1/5) − 1 = 2.919^0.2 − 1 = 23.89%. The projection then lands the price at $575 in 2030. If you take a growth rate off someone else's sheet, it was worked out on their horizon — enter their price target instead and the planner will hit that price in that year.

7. Two-stage growth

Each holding grows at its own rate through its fast-growth year, then at the "after" rate. Nothing compounds at 50% forever. Bear and Bull scenarios scale the rate by your multipliers (Bear pushes a negative rate further from zero, never toward it).

rate in year Y = own rate if Y ≤ fast-growth year, else after-rate bear = rate − |rate| × (1 − bear multiplier); bull = rate + |rate| × (bull multiplier − 1)

8. Unwind schedule and price ladder

A schedule sells a fixed percentage of the shares you hold today each year, valued at that year's price. A ladder sells a percentage of today's shares the first year the price reaches each rung. Tax is charged on the sale (section 4) and the net proceeds are moved into the holding you choose, raising its cost basis by the amount moved.

amount sold in year Y = today's value × % × (price in Y ÷ price today)

Worked example. 1,000 shares at $100 growing 26% a year; ladder 25% at $200, 25% at $400. Price passes $200 in 2028 → sells 250 shares × $200 = $50,009 (the tiny excess is the price being $200.04 that year); passes $400 in 2031 → 250 shares × $400 = $100,038. A rung the price never reaches never sells; Monte Carlo reports how often that happens.

Does spreading a sale over several years lower the tax? In this model, no. The tax on a sale is the gain times your rate, so five sales that realize the same total gain produce the same total tax as one sale that realizes it — smaller bills, same sum. There are no progressive brackets here to move between (section 4a).

What spreading does change is how long the unsold shares stay invested. If they rise, you realize more gain and pay more tax; if they fall, less of both. That is a market-exposure decision rather than a tax one, and Torsalis takes no view on it. The schedule exists so you can set the rule while you are thinking clearly, not to reduce your bill.

9. Income streams

An Income row (pension, Social Security, rent) is not capital. It pays a yearly amount from its start year, growing at its own rate from today, and reduces what the portfolio must fund. Income before retirement, or above spending, is invested into your largest diversified holding in an already-taxed account.

portfolio must fund = max(0, lifestyle cost − income) surplus invested = max(0, income − lifestyle cost)

10. Today's dollars

The Future $ / Today's $ switch changes units only, never the plan. Every figure is divided by the inflation factor for that year:

today's $ = future $ ÷ (1 + inflation)^(Y − current year)

A useful check: in today's dollars your spending reads the same number every year, because it is the same lifestyle. If it slopes, something is wrong.

11. Crash test and guardrail

The crash test replaces the growth rate with −X% for the first N years of retirement and re-runs everything. The guardrail line then searches for the spending level that would survive that crash (bisection on spending), and separately for the first later retirement year that would survive at your planned spending.

12. Monte Carlo

Each run re-plays the whole projection with returns drawn at random around your rates. Four things to know:

Your rate is a CAGR — a geometric rate — so for one holding you never draw on, the median simulated path lands on the deterministic one. The yearly return is exp(ln(1 + rate) + σ·z) − 1 with z a standard normal draw. (Some tools subtract σ²/2 here; that preserves the arithmetic mean instead and quietly turns a 10% index fund into a 5% median path. We don't.)

For any other plan the two separate, and the gap is not small. The projection is a straight line; the Monte Carlo median is a different number. Three things move it. Spending pulls it down. Selling in a bad year removes shares that never get the chance to recover — sequence-of-returns risk. A single $2M holding at 10% and 30% volatility ends at $29.5M on the straight line against a $28.3M median at $50k a year of spending; $26.3M against $24.1M at $100k; $19.9M against $16.4M at $200k; $7.2M against $3.0M at $400k. More holdings push it up. The median of a sum is not the sum of the medians, so a portfolio of skewed holdings sits above the straight line: three ordinary equity holdings with no spending at all run about 18% above it, ten about 28%, and the effect grows as you set correlation lower. And 5,000 runs is a sample. The percentiles come from 5,000 simulated lifetimes, so the median shown typically lands within about 2% of what 200,000 runs settle on, and can be 7% out — measured across the three plans the planner offers as examples and three built for the test. Every median quoted in this section is a 200,000-run figure, so it is a property of the arithmetic rather than of one sample. Editing anything re-draws the sample, so a percentile can still move a little further than your edit did. Read the spread as a shape, not to the last digit.

Holdings move together. Each year one shared market shock is drawn, plus one private shock per holding: z = √ρ · market + √(1−ρ) · own, so every holding still has unit variance but they are correlated at ρ (Mostly = 0.8, Somewhat = 0.6, Barely = 0.3). Treating a tech-plus-crypto portfolio as independent makes it look far safer than it is.

Volatility calms down after fast growth. Past a holding's fast-growth year its volatility is capped at 30% (an ordinary share). Otherwise crypto-level swings compounded for forty years produce "lucky" outcomes in the billions that nobody should plan around. Defaults: equity 30%, crypto 70%, custom 20%; the Calm/Typical/Wild control scales them ×0.7 / ×1 / ×1.4; any holding can be set by hand.

Success rate = share of 5,000 runs that never run short of spending. Percentiles are the after-tax ending balance (section 13) — a run that ends Roth-heavy and one that ends pre-tax-heavy are not comparable at face value, which is what made the spread figure wrong rather than merely imprecise.

13. After-tax net worth

"Yours after tax" is what you would keep if you sold everything today: each holding's value less the tax on its gain (section 4) at today's rates. It is the number your statement doesn't show you.

Every balance in the planner is this figure now, not only the one for today — the projection, the chart, the table, the breakdown, the crash test and the Monte Carlo percentiles. A pre-tax 401k dollar and a Roth dollar are not the same dollar, so adding them at face value produces a number nobody has. On the planner's own worked examples the before-tax figure at plan end runs 15–25% above the after-tax one.

after-tax balance = closing balance − tax owed on it tax owed = Roth: nothing · pre-tax: whole balance × income rate · brokerage: gain × gains rate

What that assumes. Everything is sold at the end of the plan, at the rates you entered. There is no step-up in basis at death, which in life can wipe out the gains tax on an inherited brokerage account; and no bracket effects from liquidating a large account in one year, which in life would push the rate up. Both are simplifications and they push in opposite directions. The before-tax figure is shown beside every after-tax one, so you can reconcile against a statement.

14. What it does not do

This is a planning model, not a tax return. It does not model tax brackets, individual tax lots (basis is allocated proportionally rather than by FIFO or specific identification — section 4), required minimum distributions, the step-up in basis at death or the bracket effects of liquidating an account in a single year (after-tax balances assume everything is sold at plan end at the rates you entered — section 13), a state’s own rules for gains (you fold your state rate into the combined figure yourself — section 4a), Social Security taxation, Medicare surcharges, or the 0% capital-gains band; rates are assumed flat for the whole plan. Growth is applied once a year. Monte Carlo assumes log-normal returns and a single correlation for the whole portfolio. If any of those matter to your decision — and for large positions they can — take the output to someone who does this for a living. Nothing here is investment, tax or legal advice.

Sources

Only what this page actually leans on, and only after checking that each says what it is cited for. Everything else here is arithmetic you can reproduce, not a claim about the law.

  1. IRS, Topic no. 409, Capital gains and losses. irs.gov/taxtopics/tc409
    Sets the 0%, 15% and 20% long-term rates by taxable income, and defines the holding period: “Generally, if you hold the asset for more than one year before you dispose of it, your capital gain or loss is long-term.” Supports the first line of the addition in section 4a, and the assumption throughout that a position is long-held.
  2. IRS, Net Investment Income Tax. irs.gov/individuals/net-investment-income-tax
    States the 3.8% rate and that it applies above a modified adjusted gross income threshold that varies by filing status. Supports the second line of the addition in section 4a, and the 23.8% and 33.1% worked examples.
  3. IRS, Publication 551, Basis of Assets. irs.gov/publications/p551
    Cited for the contrast, not for support: “If you buy and sell securities at various times in varying quantities and you can’t adequately identify the shares you sell, the basis of the securities you sell is the basis of the securities you acquired first.” That is first-in-first-out. Torsalis allocates proportionally instead, which is the divergence stated in section 4.
  4. California Franchise Tax Board, Capital gains and losses. ftb.ca.gov — capital gains and losses
    “California does not have a lower rate for capital gains. All capital gains are taxed as ordinary income.” Supports the state line in section 4a. Note that the FTB publishes no capital-gains rate, because there is not one — the 9.3% in the worked example is one taxpayer’s ordinary-income bracket, not a rate this page claims applies to Californians generally.

Found a number that doesn't reconcile? That is exactly the kind of thing we want to hear about.