The best strategy depends on your age, income, penchant for spending, loan burden and interest rates.

Share story

If you’re in your 60s and tend to spend rather than save, pay off education debt before adding to retirement accounts.

If you’re in your 20s, do the opposite.

That’s the advice from a recent study by researchers from Morningstar and its HelloWallet unit, and they also just launched a free online calculator at http://www.morningstar.com/hw/student-loans-calculator/

The test asks a few questions about a user’s age, income and tendency to save or spend an extra dollar of income, as well as the amount of the user’s student loans and the interest rate. High borrowing rates, a penchant for spending and a short time until retirement all tilt the equation toward using extra cash to pay down the student loans.

Most borrowers, however, are better off in the long run by paying the minimum balance on their student loans and stashing any extra cash into retirement accounts, rather than the other way around, said Jake Spiegel, senior research analyst for HelloWallet.

“People in their 20s and 30s are almost always better off saving more for retirement than paying loans off early,” Spiegel said. That’s because they have long time horizons for the retirement investments to compound. Older workers paying off their kids’ student loans or their own midcareer retraining costs are a different story. “If an older worker has an especially generous company match it could be a toss-up, but if there is no match, paying loans off early” is typically the better strategy, he said.

It’s an interesting exercise to work the calculator and contemplate the best payoff strategy to maximize long-run retirement income, but keep in mind there are a host of other factors that real people encounter, said Brad Bond, founder of C.B. Bond Financial Planning. The correct balance is different for each client, Bond said, but there are some guardrails to keep in mind:

Win the match. Allocate extra savings toward your 401(k) at least until you exhaust company matching funds, Spiegel said.

Don’t psych yourself out. Some people get an emotional lift simply from paying off debts early, and it removes future expenses from a budget, but it comes at a cost of less liquid wealth in retirement because you’ve missed out on years of compounding, he said.

Take advantage of free money. Just as retirement savers should take advantage of the free money associated with an employer match, Spiegel said, borrowers should take advantage of income-based repayment plans offered for many student loans. These plans weren’t factored into the new calculator, but the research paper noted their importance.

Junior, we need to talk. Sometimes, student debt just shouldn’t be a given. If the debt is for a grown child, use this study to start a conversation about how much debt, if any, you can truly afford to incur.