When a household needs cash it does not have, the 401(k) starts to look like a bank account. It is not one, but federal law gives it two emergency exits, and they work nothing alike. A 401(k) loan is a temporary removal: you borrow your own money, pay it back with interest to yourself, and owe no tax if every rule is followed. A hardship withdrawal is a permanent removal: the money leaves, income tax (and usually a 10% penalty) is taken on the way out, and the account is smaller forever. Confusing the two — or learning the loan's separation rule after changing jobs — is how a manageable problem becomes a tax bill. Here is each mechanism with its real numbers attached.

The 401(k) loan: borrowing from yourself, on the plan's terms

Not every plan offers loans — the plan document decides — but where they exist, the tax code (IRC §72(p)) sets the outer limits. You may borrow up to the lesser of $50,000 or 50% of your vested account balance, with a narrow exception that can allow up to $10,000 even when 50% of the balance is less. The $50,000 figure is reduced by your highest outstanding loan balance during the prior 12 months, so serial borrowing shrinks the ceiling. The loan must be repaid within five years (longer only for a loan used to buy your principal residence), in substantially level payments made at least quarterly. Interest is set by the plan, commonly the prime rate plus one percentage point, and it is paid into your own account.

If the loan is repaid on schedule, there is no tax and no penalty, which is the feature that makes it tempting. The costs are structural instead. The borrowed money is out of the market for the life of the loan, so a $10,000 loan taken before a strong five-year run has an opportunity cost no statement will ever print. The repayment comes from your paycheck in after-tax dollars, which quietly reduces take-home pay for years. And the interest you "pay yourself" is not deductible, while the repaid balance will be taxed again as ordinary income when you eventually withdraw it in retirement — the interest portion is, in effect, taxed twice.

The separation trap, stated plainly

The loan's sharpest edge appears when you leave the job — voluntarily or not. Most plans require the outstanding balance to be repaid shortly after separation, commonly within 60 to 90 days, though the plan's own deadline governs. Miss it, and the plan offsets the loan: the unpaid balance is treated as a distribution, reported on a Form 1099-R, taxed as income, and hit with the 10% early-distribution penalty if you are under 59½. One partial rescue exists: since 2018, a loan offset caused by separation can be rolled into an IRA or a new employer's plan by your tax-filing deadline (including extensions) for that year — but that means producing the full offset amount in cash, from outside the old account, which is precisely what someone who just lost a job may not have. A loan that looks safe while you are employed becomes a deadline the moment you are not. The federal version of the same warning lives in our guide to TSP loans, where separation carries the identical risk.

The hardship withdrawal: permanent, taxed, and gated

A hardship withdrawal is not a right; it is a plan feature, and the IRS confines it to an immediate and heavy financial need, limited to the amount necessary to meet that need. The regulatory safe-harbor list covers: medical care expenses; costs of buying a principal residence; tuition and related education expenses for the next 12 months; payments to prevent eviction or foreclosure on a principal residence; burial and funeral expenses; and repairs for casualty damage to a principal residence, along with expenses from certain federally declared disasters. You must generally have taken other distributions and loans available under the plan first, and the plan can require documentation.

The tax treatment is the mirror image of the loan's. The withdrawal is ordinary income in the year received. If you are under 59½, the 10% early-distribution penalty applies on top — hardship status does not waive it. (Separate penalty exceptions exist for specific situations, such as a first-home purchase from an IRA or separation at 55 or later from that employer's plan, but "hardship" by itself is not one of them.) The money cannot be repaid or rolled over; the contribution space it occupied is gone permanently. Plans may impose a suspension or other administrative consequences — check the plan document, since the details are plan-specific.

The same $10,000, priced three ways

Take a worker in the 22% federal bracket, under 59½, who needs $10,000 in hand. A loan of $10,000 delivers $10,000 and costs the foregone market growth on $10,000 over the repayment period, plus the separation risk described above. A hardship withdrawal that nets $10,000 must be grossed up for the 22% tax and 10% penalty: $10,000 divided by 0.68 is $14,706 withdrawn to net $10,000 — $4,706 surrendered to taxes and penalties, before counting the decades of compounding that $14,706 will never do. A withdrawal of exactly $10,000, without the gross-up, nets only $6,800. That gap — the same emergency costing $10,000 or $14,706 of retirement savings — is the whole comparison in one line.

Missed payments while you are still employed

The separation trap gets the attention, but a loan can also go bad without any job change. Miss a scheduled payment and the plan typically allows a cure period — often through the end of the calendar quarter following the quarter in which the payment was missed, though the plan document governs. Miss the cure deadline and the outstanding balance becomes a deemed distribution: taxable in that year, penalized if you are under 59½, and reported on a 1099-R — even though, unlike a separation offset, the loan remains on the books and continues to accrue interest until it is actually repaid or offset. You can therefore be taxed on money you still owe the plan, which is the worst cell in the whole table. Plans may also limit you to one loan at a time, impose a waiting period after a payoff, or set a minimum loan amount; none of those details are in the tax code, so the plan's loan policy — a document your HR portal already has — is part of the real comparison.

Which one, when

The loan is the lesser harm for a genuinely short, dated, certain need — a bill with a deadline and a repayment source you can name — taken by someone whose job is stable and whose plan allows it. The hardship withdrawal is the last resort inside the retirement system, defensible mainly when it prevents a larger catastrophe such as foreclosure, and only after the alternatives outside the plan have been priced: a personal loan, a payment plan with the creditor, or the triage order in our guide to what to do with an old 401(k) for money that has already left an employer. What neither should fund is ordinary consumption: both convert your highest-value savings — tax-deferred, creditor-protected, compounding — into the most expensive cash in the household.

Official documentation and references

Keep going

Educational disclaimer: This article is general education, not personalized financial, tax, legal, or benefits advice. Primary sources, plan documents, and — for insurance and estate topics — your state's law and licensed professionals govern your situation. All numbers in examples are illustrative.