In some corners of the personal finance advice world, getting into debt is just about the worst thing you can do. And yes, some forms of debt — particularly those that charge high interest rates — can keep you locked in a cycle of owing money for years.

Still, there are times where taking on debt serves a purpose in your overall financial picture. Debt isn’t always bad, though there is always a risk of getting in over your head. It’s simply a tool you can use to afford a very large purchase without draining your savings.

“I think it’s so important for people to not be afraid of debt, but instead to look at it as something you can use to your advantage,” says Kara Duckworth, a certified financial planner and managing director of client experience at Mercer Advisors.

Here are a few examples of when the ability to borrow money can come in handy.

For something that may go up in value

Debt is often categorized as good or bad, depending on the reason you borrow money and how much you’ll pay in interest.

“Good debt can help you move forward with your career and life,” says Mark Reyes, a certified financial planner and senior manager of financial assistance at financial services app Albert. “On the other hand, bad debt can hold you back from reaching your goals.”

Mortgages are commonly cited as an example of good debt, since a home can appreciate in value. “That’s not a bad debt to have; it’s going to put a roof over your head,” says Bill Hampton, a certified financial education instructor and CEO of Hampton Tax and Financial Services in Atlanta. Of course, borrowing more than you can afford or not understanding the terms of the loan can cause financial risk.

Student loans are another generally agreed-upon example of good debt, since your education can boost your lifetime earning potential. According to Hampton, “You’re going to be in debt for a number of years, but it’ll get you a higher-paying job. But if your major doesn’t support your debt, it could hold you back.”

To fund a major purchase

Now for the bad debt: credit cards. Not only do they charge high interest rates, but you can keep putting purchases on them even if you still owe money from prior months. It’s easy to end with a balance that keeps growing, no matter how much you try to chip away at it.

However, some credit cards offer no-interest promotions you can use for a large purchase. These promotions allow you to spread out a cost over many months, often 12 months or longer, depending on the card. Make sure your budget allows you to pay it off in the promotional time frame, though — before interest kicks in.

If you have existing debt, balance transfer cards allow you to move that debt over and pay no interest for months. But as always, make sure you understand the terms of the card you use — you’ll likely pay a fee to transfer, and the interest rate will climb back up once the promotion ends.

Once you own a home, borrowing against its value in the form of a home equity loan or home equity line of credit — or HELOC — can free up cash for home renovations. Homeowners can opt to do this instead of putting renovation costs on a credit card charging a higher interest rate.

“Depending on how much equity a person has and depending on their specific situation, it might be better to tap into that than a credit card or personal loan,” Reyes says. “It’s kind of the lesser of two evils.”

To weather unexpected costs

You’ve heard the lecture before. You need to have emergency savings. But that’s the thing about emergencies — they happen at random, and sometimes simultaneously, whether you’ve been able to save up spare cash or not.

These are the moments when you may have to make the best less-optimal decision, and that can mean taking on debt. HELOCs and personal loans may be a lower-interest way to borrow money to cover an emergency situation, but credit cards can also serve as a backup source of emergency funding.

If an emergency expense lands you in credit card debt, Hampton recommends making a plan to pay that balance off over a few paychecks. You can also take other actions to lower the cost of your debt, like moving the debt to a balance transfer card or seeing if your credit card company will meet you halfway.

“Consider calling your credit card company and try to negotiate a lower interest rate from what you’re being charged,” Reyes says. “It’s not always successful and it’s not likely, but it’s worth a shot.”

This article was written by NerdWallet and was originally published by The Associated Press.