How should I calculate the opportunity cost of using a 401(k) loan?
One way to analyze the opportunity cost of using a 401K loan would be to calculate your net worth after using a 401K loan.  If your net worth increases then the 401K loan would be advisable.  Note that the calculations provided below do not take into account tax considerations. A net worth calculation is where you add all your assets and then subtract all your liabilities.  The resulting number is your net worth. First, calculate the net worth of not taking the loan and simply paying the credit card interest.  This means you only pay the interest on the credit card.  In addition to the parameters identified in your question, two additional parameters will need to be considered: Cash and the market rate of return on the 401K. Scenario 1 (only pay credit card interest): After 12 months all you have paid is the interest on the credit card.  The 401K balance is untouched so it will hopefully grow.  The balance on the credit card remains at the end of 12 months. Scenario 2 (use 401K loan to pay credit card balance): You borrow $5,000 from your 401K to pay the credit card balance.  You will have to pay $5,000 plus the 401K interest rate back into your 401K account. Use the following equation to determine when Scenario 2 increases your net worth more than scenario 1: Thus, if your credit card interest rate is greater than the rate you can earn on your 401K then use the 401K loan to pay off the credit card balance. Another scenario that should be considered: borrow money from somewhere else to pay off the credit card balance. Scenario 3 (external loan to pay credit card balance): You borrow $5,000 from somewhere besides your 401K to pay off the credit card balance. The following is used to determine if you should use an external loan over the 401K loan: This means you should use an external loan if you can obtain an interest rate less than the rate of return you can earn on your 401K.  The same methodology can be used to compare Scenario 3 to Scenario 1. "There is no equation. Only data that would help you come to the decision that's right for you.  Assuming the 401(k) is invested in a stock fund of one sort or another, the choice is nearly the same as if you had $5K cash to either invest or pay debt.  Since stock returns are not fixed, but are a random distribution that somewhat resembles a bell curve, median about 10%, standard deviation about 14%. It's the age old question of ""getting a guaranteed X% (paying the debt) or a shot at 8-10% or so in the market."" This come up frequently in the decision to pre-pay mortgages at 4-5% versus invest. Many people will take the guaranteed 4% return vs the risk that comes with the market. For your decision, the 401(k) loan, note that the loan is due if you separate from the company for whatever reason. This adds an additional layer of risk and another data point to the mix. For your exact numbers, the savings is barely $50. I'd probably not do it. If the cards were 18%, I'd lean toward the loan, but only if I knew I could raise the cash to pay it back to not default." Make sure that when you have the loan you still contribute enough to get the company match. For example:  An inability to maximize the match might need to be figured into the opportunity cost of the loan. Some companies will suspend your contributions for a specific number of months for a hardship withdraw.  Make sure you understand where the money comes from for the loan. Can you count the money that the company matched but you are not vested with, when determining the maximum amount of the loan?  If the money is in what is now a closed fund can you replenish the funds back into that fund if use it to fund the loan? Know what the repayment time period is of the loan.
At 22 years old, you can afford to be invested 100% in the stock market. Like many others, I recommend that you consider low cost index funds if those are available in your 401(k) plan. Since your 401(k) contributions are usually made with each paycheck this gives you the added benefit of dollar cost averaging throughout your career.  There used to be a common rule that you should put 100 minus your age as the percentage invested in the stock market and the rest in bonds, but with interest rates being so low, bonds have underperformed, so many experts now recommend 110 or even 120 minus your age for stocks percentage. My recommendation is that you wait until you are 40 and then move 25% into bonds, then increase it to 40% at 55 years old. At 65 I would jump to a 50-50 stock/bonds mix and when you start taking distributions I would move to a stable-value income portfolio. I also recommend that you roll your funds into a Vanguard IRA when you change jobs so that you take advantage of their low management fee index mutual funds (that have no fees for trading).  You can pick whatever mix feels best for you, but at your age I would suggest a 50-50 mix between the S&P 500 (large cap) and the Russell 2000 (small cap). Those with quarterly rebalancing will put you a little ahead of the market with very little effort. "Understand your own risk tolerance and discipline. From Moneychimp we can see different market results -  This is a 15 year span, containing what was arguably one of the most awful decades going. A full 10 year period with a negative return. Yet, the 15 year return was a 6.65% CAGR. You'd net 5.65% after long term cap gains. Your mortgage is likely costing ~4% or 3% after tax (This is not applicable to my Canadian friends, I understand you don't deduct interest). In my not so humble opinion, I'd pay off the highest rate debts first (unlike The David followers who are happy to pay off tens of thousands of dollars in 0% interest debt before the large 18% debt) and invest at the highest rate I'd get long term. The problem is knowing when to flip from one to the other.  Here's food for thought - The David insists on his use of the 12% long term market return. The last 100 years have had an average 11.96% return, but you can't spend average, the CAGR, the real compound rate was 10.06%. Why would he recommend paying off a sub 3% loan while using 12% for his long term planning (All my David remarks are not applicable to Canadian members, you all probably know better than to listen to US entertainers)?  I am retired, and put my money where my mouth is. The $200K I still owe on my mortgage is offset by over $400K in my 401(k). The money went in at 25%/28% pretax, has grown over these past 20 years, and comes out at 15% to pay my mortgage each month. No regrets. Anyone starting out now, and taking a 30 year mortgage, but putting the delta to a 15 year mortgage payment into their 401(k) is nearly certain to have far more in the retirement account 15 years hence than their remaining balance on the loan, even after taxes are considered. Even more if this money helps them to get the full matching, which too many miss.  All that said, keep in mind, the market is likely to see a correction or two in the next 15 years, one of which may be painful. If that would keep you up at night, don't listen to me. If a fixed return of 4% seems more appealing than a 10% return with a 15% standard deviation, pay the mortgage first.  Last - if you have a paid off house but no job, the town still wants its property tax, and the utilities still need to be paid. If you lose your job with $400K in your 401(k)/IRA but have a $200K mortgage, you have a lot of time to find a new job or sell the house with little pressure from the debt collectors.  (To answer the question in advance - ""Joe, at what mortgage rate do you pay it off first?"" Good question. I'd deposit to my 401(k) to grab matching deposits first, and then if the mortgage was anywhere north of 6%, prioritize that. This would keep my chances at near 100% of coming out ahead.)" "There is no penalty for foreigners but rather a 30% mandatory income tax withholding from distributions from 401(k) plans. You will ""get it back"" when you file the income tax return for the year and calculate your actual tax liability (including any penalties for a  premature distribution from the 401(k) plan). You are, of course, a US citizen and not a foreigner, and thus are what the IRS calls a US person (which includes not just US citizens but permanent immigrants to the US as well as some temporary visa holders), but it is entirely possible that your 401(k) plan does not know this explicitly. This IRS web page tells 401(k) plan administrators Who can I presume is a US person?   A retirement plan distribution is presumed to be made to a U.S. person only if the withholding agent: A payment that does not meet these rules is presumed to be made to a foreign person.  Your SSN is presumably on file with the 401(k) plan administrator, but perhaps you are retired into a country that does not have an income tax treaty with the US and that's the mailing address that is on file with your 401(k) plan administrator? If so, the 401(k) administrator is merely following the rules and not presuming that you are a US person. So, how can you get around this non-presumption? The IRS document cited above (and the links therein) say that if the 401(k) plan has on file a W-9 form that you submitted to them, and the W-9 form includes your SSN, then the 401(k) plan has valid documentation to associate the distribution as being made to a US person, that is, the 401(k) plan does not need to make any presumptions; that you are a US person has been proved beyond reasonable doubt. So, to answer your question ""Will I be penalized when I later start a regular monthly withdrawal from my 401(k)?"" Yes, you will likely have mandatory 30% income tax withholding on your regular 401(k) distributions unless you have established that you are   a US person to your 401(k) plan by submitting a W-9 form to them." I've read the answers and respect the thought behind them.  I'd like to focus on (a) the magnitude of the emergency, and (b) the saving rate of the people affected. 3-6 months is interesting. It's enough not just to fix the car, repair the A/C, etc, but more than enough to lose one's job and recover. (Let's avoid the debate of how long it take to find a job, no amount of 'emergency savings' can solve that.) If one is spending below their means, any unexpected expense that can paid off within, say 3 months, doesn't really need to tap emergency funds (EF). And, at some level of income and retirement savings, one can more easily run a much lower EF.  My own situation - I had 9mo worth of expenses saved as EF. We were living well beneath our means, and I was looking at the difference between our mortgage (6%+) vs bank interest (near 0%). I used the funds to pay down principal, refinanced to a lower rate, and at the same closing got a HELOC. The psychology of this is tough, it then appears that for simple expenses, I'd be borrowing from my HELOC. On the other hand, the choice was between a known cost, the $5K/year the money was costing by sitting there plus the lower rate by going to a non-jumbo loan at the time, vs the risk of using 3% money from the HELOC. In the end, the HELOC was never tapped for more than a small portion of its line, and I never regretted the decision. Ironically, it's the person who isn't saving much that need the EF most. If you are a saver, you need to judge how long it would take to replace the funds.  I offer the above not as a recommendation, but as devil's advocate to the other excellent advice here. All cash flows are a choice, $100 going here, can't go there. I'd slip in a warning that one should capture matching 401(k) contributions, if offered, before funding the EF. And pay down any high interest debt. After that, the decision of how liquid to be is a personal choice, what worked for my wife and me may not be for everyone. The equation is the same one used for mortgage amortization.  You first want to calculate the PV (present value) for a stream of $50K payments over 20 years at a10% rate.  Then that value is the FV (future value) that you want to save for, and you are looking to solve the payment stream needed to create that future value. Good luck achieving the 10% return, and in knowing your mortality down to the exact year. Unless this is a homework assignment, which need not reflect real life.  Edit - as indicated above, the first step is to get that value in 20 years:  The image is the user-friendly entry screen for the PV calculation. It walks you though the need to enter rate as per period, therefore I enter .1/12 as the rate. The payment you desire is $50K/yr, and since it's a payment, it's a negative number. The equation in excel that results is: =PV(0.1/12,240,-50000/12,0) and the sum calculated is $431,769 Next you wish to know the payments to make to arrive at this number:  In this case, you start at zero PV with a known FV calculated above, and known rate. This solves for the payment needed to get this number, $568.59 The excel equation is: =PMT(0.1/12,240,0,431769) Most people have access to excel or a public domain spreadsheet application (e.g. Openoffice). If you are often needing to perform such calculations, a business finance calculator is recommended. TI used to make a model BA-35 finance calculator, no longer in production, still on eBay, used.  One more update- these equations whether in excel or a calculator are geared toward per period interest, i.e. when you state 10%, they assume a monthly 10/12%. With that said, you required a 20 year deposit period and 20 year withdrawal period. We know you wish to take out $4166.67 per month. The equation to calculate deposit required becomes - 4166.67/(1.00833333)^240= 568.59  HA! Exact same answer, far less work. To be clear, this works only because you required 240 deposits to produce 240 withdrawals in the future. "Can is fine, and other answered that. I'd suggest that you consider the ""should."" Does your employer offer a matched retirement account, typically a 401(k)? Are you depositing up to the match?  Do you have any higher interest short term debt, credit cards, car loan, student loan, etc?  Do you have 6 months worth of living expenses in liquid funds?  One point I like to beat a dead horse over is this - for most normal mortgages, the extra you pay goes to principal, but regardless of how much extra you pay, the next payment is still due next month. So it's possible that you are feeling pretty good that for 5 years you pay so much that you have just 10 left on the 30 year loan, but if you lose your job, you still risk losing the house to foreclosure. It's not like you can ask the bank for that money back.  If you are as disciplined as you sound, put the extra money aside, and only when you have well over the recommended 6 months, then make those prepayments if you choose.  To pull my comment to @MikeKale into my answer - I avoided this aspect of the discussion. But here I'll suggest that a 4% mortgage costs 3% after tax (in 25% bracket), and I'd bet cap gain rates will stay 15% for non-1%ers. So, with the break-even return of 3.5% (to return 3 after tax) and DVY yielding 3.33%, the questions becomes - do you think the DVY top yielders will be flat over the next 15 years? Any return over .17%/yr is profit. That said, the truly risk averse should heed the advise in original answer, then pre-pay. Update - when asked,in April 2012, the DVY I suggested as an example of an investment that beats the mortgage cost, traded at $56. It's now $83 and still yields 3.84%. To put numbers to this, a lump sum $100K would be worth $148K (this doesn't include dividends), and giving off $5700/yr in dividends for an after-tax $4800/yr. We happened to have a good 4 years, overall. The time horizon (15 years) makes the strategy low risk if one sticks to it." "I don't think ""cost of carry"" is the right word here.  Yes, you have the opportunity cost (what you could have earned during that time if you had invested the money somehwere else) and then you also have interest rate risk and default risk." "I frequently advise to go 401(k) up to the match. With no match, I'm not so sure.  If you are in the 15% bracket, I'd skip the 401(k). Your standard deduction is $5800 this year, do you itemize? I ask because the 15% bracket ends at $34,500, and I don't know if you manage enough deductions to get under that.  But - I'd only pt into the 401(k) what would otherwise be taxed at 25%, no more. Even then only if the 401(k) expenses were pretty reasonable. Will all the hoopla over retirement accounts, we easily forget the beauty of the investment in ETFs long term. You buy the SPY (S&P 500 ETF) and hold it forever. The gains are all deferred until you sell, and then they have a favored rate. You control the timing of the sale with no risk of penalty. The expenses are low, and over time, can make up for the lack of tax deduction (The pretax deposit) vs the 401(k) account. You die and the beneficiaries have a stepped up basis with no tax due (under whatever the limit is that year).  Long term, I'd go with low cost ETFs and pay the mortgage at the minimum payments. Even without itemizing, 4.2% is pretty low compared to the expected return over the next decade in stocks.  I recommend a look at Fairmark to help understand your marginal rate. Your gross doesn't matter as much as that line on 1040 ""taxable income."" This will tell you if you are in the 25% bracket and if so, how deep.  Edit - If one's taxable income, line 43 on your 1040, I believe, puts him into the 15% bracket, there are issues using a pretax 401(k). The priority should be to use a Roth IRA or Roth 401(k). Being so close to that 25% bracket at 26 tells me you will grow, and/o marry into it over time, that's the ideal time to use the pre-tax 401(k) to stay at 15%. i.e. deposit just enough to bring your taxable income right to that line of 15/25%."