It's a million-dollar question...often literally. That is, if you've borrowed money to attend college or even earn a post-graduate degree, should you pay off those interest-accruing loans first before putting any money into a retirement nest egg? Sometimes the very best investment you can make is minimizing the amount of interest you pay on debt during your lifetime, after all.
The answer is simple: "It depends."
That's not a cheeky non-answer though. It really does depend on a handful of factors. The good news is, the criteria used to make the decision is actually rather clear.

Image source: Getty Images.
Former students are sitting on a debilitating amount of debt
The statistics are staggering. As the The Motley Fool's in-house research points out, 42.3 million Americans owe an average of $39,376 apiece on their federal student loans. The typical monthly payment on this debt is in the ballpark of $300, although roughly 40% of borrowers are shelling out more than that just to keep their loan in good standing. At that rate, it could easily take 20 years -- if not longer -- to clear out this debt and start using this money for other purposes, like saving it for retirement.
And that's a problem.
See, for most people, it's not savvy stock-picking or even tucking away massive amounts of your income in a retirement account that will do the bulk of the work. Time actually does most of the heavy-lifting for most savers. And the earlier you start, the disproportionally bigger your retirement nest egg gets.
Assuming you'll achieve the market's long-term average annual gain of around 10% (and reinvesting any dividends dished out along the way), for perspective, every $1 saved today will be worth $2.59 in 10 years' time. In 20 years though, that $1 will be worth $6.73. And in 30 years, a $1 investment in the stock market today should be worth roughly $17.45.
That's the power of compounding -- your absolute returns get much bigger the longer you're invested. You just have to start the latter years with as much seed capital as possible saved up in the early years. That's easier said than done when you're forking over what's likely to be the bulk of your leftover monthly income after all your living expenses have been paid.
Yet, given that it can adversely impact your credit score, it's not as if just not paying on these loans is an option. What's a person to do?
Again, it depends. What it depends on, however, is actually pretty clear.
Weighing your options
Student loans have evolved over the course of the past couple of decades. At one point, they were pretty conventional; you were expected to repay these loans plus a reasonable amount of interest for however long it took to clear your debt.
In recent years though, several time-limited or income-based paths to repayment have materialized. The income-driven repayment (or IDR) plan's payment varies with your income, for example, and can be as little as $0 per month for lower earners. Or if you work for a local, state, or the federal government, the public service loan forgiveness (or PSLF) program forgives your loan after making 120 months' worth of minimum required payments even if you've not actually paid back all the money you owe.
The point is, it's possible you're eligible -- or will be -- for partial or even full loan forgiveness. You'll simply need to dig into the details of your loan, and these programs to know for sure. If you are going to qualify for such forgiveness, in these instances your smartest move is usually finding a way to make sure you eventually do become eligible for this benefit by toughing out the minimum monthly payments for as long as it takes. Your credit score will thank you.
Just don't neglect to save whatever's left at the end of the month if you go down this path. Even if it's not a lot, every little bit helps. Remember, time is an investor's biggest ally, but you've got to give time at least a little money to work with.
But most people will be on the hook for what's effectively an ordinary interest-accruing loan (particularly student loans held by private lenders), which must be repaid in full, and won't likely be discharged by bankruptcy. What then?
This is where it takes a bit of digging to determine exactly what you're paying in interest charges. As a rule of thumb, anything above an annualized interest rate of 6% is nearing the effective return you might achieve by investing your payment money instead. In this instance, your best bet is likely just to pay off this loan as soon as possible.
Conversely, annual interest charges of less than 6% on a student loan is relatively cheap. Although you'll still need to make a minimum monthly payment on this debt, you're generally better served by investing any amount above and beyond this minimum in the stock market, where you'll likely experience an even greater average yearly return on this money.
Now, don't become so rigid on the issue that you miss a prime opportunity to dramatically beat the market's long-term average return. That's your employer's match of your contribution to a 401(k) account. Although no company completely matches your deposits, contributing the amount your employer is willing to match is effectively a 100% return on your investment in retirement.
Just be sure you're not taking on more debt (like credit card debt) in the meantime while you're fighting to pay down your student loan and/or getting the best start you can on your retirement savings. This defeats the purpose of working hard to minimize the net cost of your total debt, while simultaneously maximizing your investment returns.
Make a you-specific comparison of your options
Etched in stone? No. There are exceptions. It could make sense to go "all-out" on your loan repayment efforts even if you might eventually qualify for loan forgiveness. Or in some cases, it makes the most sense to prioritize investing even if you owe on a high-interest student loan. Never say never.
Presuming you've done a bit of your own comparative number-crunching though, you'll spot these exceptions to the rule when you see them. And don't forget to factor in the intangible and qualitative details either, such as your health, likely changes to your future income, or an inheritance that could dramatically change your financial situation.
More than anything though, just remember that time can be an investor's best friend or worst enemy. Don't waste any of it that you can avoid wasting, since it's the one asset you can never get back. You just have to figure out how to best optimize it for your situation.