Kevin O'Leary shares his No. 1 piece of advice for paying off student loans

More than 44 million Americans currently have student loans, and Americans held nearly $1.38 trillion in student debt at the end of 2017, according to the New York Federal Reserve.

For the young people who are just now taking on student loans, personal finance expert Kevin O'Leary has a word of advice: Pay them off immediately.

"Get rid of that student debt right up front while you're young and frisky, that's the time to do it," the star of ABC's "Shark Tank" tells CNBC Make It.

His advice? Instead of paying a little bit at a time, make paying off your student debt your No. 1 priority after graduation.

"You should pay that loan off in 36 months if you can do it," O'Leary says.

That "means you're cutting back your lifestyle significantly. You're spending up to 40 percent of your paycheck just to get rid of it. Why? Because it's a very nasty thing to have hanging over your head for a very long period of time," he explains.

Indeed, even Baby Boomers are still paying off their student loans, according to analysis of 2017 student loan data by Experian. Boomers, ages 50 through 70 in Experian's report, held an average student loan balance of $36,246.

There are 6.8 million student loan borrowers between the ages of 40 and 49, according to 2016 data from the Federal Reserve. Together, those graduates hold a collective $229.6 billion in debt.

While many young people imagine it will be easier to pay off their loans later in life when they have a higher salary, O'Leary argues that by that point, you will also have higher expenses, less time and more responsibility.

"The minute you establish a lifestyle and you start going out for dinner, and you start dating or you get married, all of a sudden, you have all kinds of other expenses, not necessarily just paying off your loan," O'Leary says.

"That's why you want to pay your loan off as fast as you can, before your lifestyle starts to really creep in on you and make you spend more on things like vacations, and dating, and dinners, and when a child comes along, all of those expenses."

Plus, the earlier you pay off your loan, the more you save in interest payments over time.

Student loan interest rates are "generous at the beginning, but over the long term that interest really adds up," O'Leary says. For federal undergraduate student loans, the interest rate is 5.05 percent for the 2018-2019 academic year, up from 4.45 percent last year.

For a loan of $50,000 with that interest rate, paid off over 10 years with a minimum payment of $50 per month, a graduate would end up paying $14,473.25 in interest, according to a calculator by PrivateStudentLoans.guru.

In order to pay off that $50,000 loan in just three years, a borrower would have to make payments of $1,500 per month, according to the calculator. But by funneling so much money toward monthly payments and reducing the length of the loan, the total amount paid in interest falls by almost $10,000 down to $4,616.36, according to the calculator.

O'Leary argues the short-term focus is worth the long-term savings.

"I know it sounds like a lot, but really smart people figure this out pretty quickly and they focus on getting rid of that debt," O'Leary says.

Don't miss: Kevin O'Leary: Here's how much an MBA matters in business '

Like this story? Subscribe to CNBC Make It on YouTube!

Disclosure: CNBC owns the exclusive off-network cable rights to "Shark Tank."