There may not be a magic bullet for getting out of student loan debt, but there is a holy grail, of sorts, for some borrowers: student loan refinancing.

Here’s how it works: If you qualify, a lender will buy your existing loan, or loans, and issue a new one. Depending on your credit, you could get a lower interest rate, which would save you money in the long run.

Say, for example, you left college with a $30,000 private student loan with a 7% interest rate and a standard 10-year loan term. If you refinanced that loan right away at 3.5%, you’d save more than $6,000 in interest over the life of your loan. You could use the money to start an emergency fund, save for retirement or go on vacation.

Here’s what you need to know about refinancing your student loans.

In general, you’ll need three things to qualify:

Refinancing is a great option for borrowers who have private loans with high interest rates. Federal loans also can be refinanced, but you’ll lose access to federal loan protections, such as income-driven repayment and forgiveness options. That’s why it’s usually best to exclude federal loans during refinancing.

Nerd Tip: If a lender offers prequalification, you might want to go through that process to get an idea of how much you could save without having a hard inquiry on your credit history, which lowers your credit score.

To determine if refinancing is a good option, compare your current loan terms against your potential loan terms. You’ll save the most money by getting your interest rate as low as possible. Consider other aspects of your loan as well to get the full picture. For example, if you have a loan with a 6% interest rate, refinancing it at 5% would make sense only if you didn’t have to extend the loan term.

Use NerdWallet’s student loan refinance calculator to estimate your potential savings and see if refinancing is right for you.

You can use a co-signer if your own credit score isn’t 700 or above. But if you’d rather refinance on your own, focus on paying your bills on time and reducing any credit card debt to boost your credit score before applying.

Check your credit score here.

If refinancing makes sense and you’re willing to make the effort, it could help you save thousands of dollars in interest payments over the life of your loan. That’s at least worth considering.

Devon Delfino is a staff writer at NerdWallet, a personal finance website. Email: Twitter: @devondelfino.

The article This Student Loan Move Could Save You Thousands originally appeared on NerdWallet.