The original question was aimed at early payment on a student loan at 6%. Let's look at some numbers.
Note, the actual numbers were much lower, I've increased the debt to a level that's more typical, as well as more likely to keep the borrower worried, and "up at night."
On a $50K loan, we see 2 potential payoffs. A 6 year accelerated payoff which requires $273.54 extra per month, and the original payoff, with a payment of $555.10.
Next, I show the 6 year balance on the original loan terms, $23,636.44 which we would need to exceed in the 401(k) to consider we made the right choice.
The last section reflects the 401(k) balance with different rates of return. I purposely offer a wide range of returns.
Even if we had another 'lost decade' averaging -1%/yr, the 401(k) balance is more than 50% higher than the current loan debt. At a more reasonable 6% average, it's double. (Note: The $273.54 deposit should really be adjusted, adding 33% if one is in the 25% bracket, or 17.6% if 15% bracket. That opens the can of worms at withdrawal. But let me add, I coerced my sister to deposit to the match, while married and a 25%er. Divorced, and disabled, her withdrawals are penalty free, and $10K is tax free due to STD deduction and exemption.)
Note: The chart and text above have been edited at the request of a member comment.
What about an 18% credit card? Glad you asked -
The same $50K debt. It's tough to imagine a worse situation. You budgeted and can afford $901, because that's the number for a 10 year payoff. Your spouse says she can grab a extra shift and add $239/mo to the plan, because that' the number to get to a 6 year payoff.
The balance after 6 years if we stick to the 10 year plan? $30,669.82. The 401(k) balances at varying rates of return again appear above. A bit less dramatic, as that 18% is tough, but even at a negative return the 401(k) is still ahead. You are welcome to run the numbers, adjust deposits for your tax rate and same for withdrawals. You'll see -1% is still about break-even.
To be fair, there are a number of variables, debt owed, original time for loan to be paid, rate of loan, rate of return assumed on the 401(k), amount of potential extra payment, and the 2 tax rates, going in, coming out. Combine a horrific loan rate (the 18%) with a longer payback (15+ years) and you can contrive a scenario where, in fact, even the matched funds have trouble keeping up. I'm not judging, but I believe it's fair to say that if one can't find a budget that allows them to pay their 18% debt over a 10 year period, they need more help that we can offer here. I'm only offering the math that shows the power of the matched deposit.
From a comment below, the one warning I'd offer is regarding vesting. The matched funds may not be yours immediately. Companies are allowed to have a vesting schedule which means your right to this money may be tiered, at say, 20%/year from year 2-6, for example. It's a good idea to check how your plan handles this.
On further reflection, the comments of David Wallace need to be understood. At zero return, the matched money will lag the 18% payment after 4 years. The reason my chart doesn't reflect that is the match from the deposits younger than 4 years is still making up for that potential loss. I'd maintain my advice, to grab the match regardless, as there are other factors involved, the more likely return of ~8%, the tax differential should one lose their job, and the hope that one would get their act together and pay the debt off faster.