Skip to content

Instantly share code, notes, and snippets.

@greglook
Created August 19, 2016 20:04
Show Gist options
  • Save greglook/3206b92046b6710d8f81cef3c10f09ac to your computer and use it in GitHub Desktop.
Save greglook/3206b92046b6710d8f81cef3c10f09ac to your computer and use it in GitHub Desktop.

401(k) Penalty Calculation

Given:

  • x starting contribution
  • t marginal tax rate
  • n number of compounding periods (years)
  • g compounding growth per period
  • p early-withdrawal penalty

Then we want to figure out, if the money is put into a tax-deferred account, how long does it need to be left there before taking it out (and paying a penalty) results in the same or more value than taking the tax hit up front?

The only reason that the winning strategy is not always, "don't pay the penalty" is that in a tax-deferred account the growth is tax free until you pull the money out of the account.

x*(1-t)*((1+g*(1-t))^n) <= x*(1-t)*(1-p)*((1+g)^n)

(1+g*(1-t))^n <= (1-p)*((1+g)^n)

((1+g*(1-t))/(1+g))^n <= 1-p

n >= ln(1-p)/ln((1+g*(1-t))/(1+g))

n >= ln(1-p)/(ln(1+g*(1-t)) - ln(1+g))

As a convenient bc function:

define worth_it_in(p, g, t) { return l(1-p)/(l(1+(g*(1-t)))-l(1+g)); }

Results

Plugging in some real numbers for p, t, and g we can find out how many years results in more money in the tax-deferred account. p is currently 10% in US tax law. Lets say that you're in the 25% marginal tax bracket and expecting nominal investment growth of 5% (very conservative according to market history):

t = 0.25
p = 0.10
g = 0.05

n >= ln(1-0.10)/(ln(1+(0.05*0.75)) - ln(1+0.05))

n >= ln(0.90)/(ln(1.0375) - ln(1.05))

n ~= 8.79 years

So, you'd have more money if you contributed to the 401(k), waited about 9 years, then withdrew it and paid the penalty than you would if you kept it and invested it in a taxable account.

Using less conservative numbers like being in the 28% marginal bracket and seeing nominal growths of ~9% the numbers come out to ~4.5 years for break-even.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment