Rising student loan debt may be hampering young people's ability to buy homes or even move out of their parents' basements. But that does not mean student loan borrowers always should be in a hurry to pay off this debt.

In fact, young borrowers could wind up poorer in the long run if they prioritize rapid debt repayment over saving for retirement, financial planners said.

That's because retirement contributions typically offer tax breaks, company matches and future compounding that are worth far more than the interest saved by accelerated student loan repayment.

"People focus on the now and keep putting their retirement savings farther away," said Conner Kolodge, wealth manager for Accredited Investors in Edina, Minnesota. "That can be a costly mistake."

As more young people incur student loan debt in ever-increasing amounts, it's essential that they understand the costs of prioritizing debt repayment over retirement savings, planners said.

A recent TransUnion study of "credit active" consumers — people with at least one credit account or loan — found that 51 percent of those aged 20 to 29 now have student loan debt, compared to 31 percent in 2005.

Balances have soared as well, the study found. The average balance for a 20-something borrower in 2014 was $25,525, compared to $15,853 in 2007. That's a 60 percent increase.

An Experian study found an even greater rise in student loan debt when the rest of the population was counted in. Experian's study of its own credit reports found student loan debt had risen 84 percent between 2008 and 2014 and that the average balance for borrowers of all ages was $29,000.

Bachelor's degree recipients who graduated in 2014 with debt owe an average $33,000, according to financial aid expert Mark Kantrowitz, publisher of EdVisors.com, a college finance resource site.

But even that amount of debt isn't prohibitive as long as the graduate lands a job with an annual salary that tops that amount - something college graduates typically do, Kantrowitz said.

Census Bureau data shows that for people aged 25 to 34 in 2012, the median earnings for those with a bachelor's degree was $46,900, while the median for high school graduates without a college degree was $30,000.

"If total student loan debt at graduation is less than the annual starting salary, the borrower will be able to repay his or her student loans in 10 years or less," Kantrowitz said.