GraduatesWhen I talk to college students (or their parents), a common question often comes up: Is it more important to pay off student loan debt first or get started with investing? As the CEO of automated investing service Betterment, I’m a huge advocate for starting early. Time in the market is one of the biggest factors in building long-term wealth. But it’s not as simple as it sounds.

The rule of thumb: Start by paying off all higher interest debt first, like credit cards or student loans with rates of more than 5%. Make all minimum loan payments, no matter the rate. If you have a 401k match at work, maximize it. Then, with your remaining assets, invest according to your goals.

Here’s why:

All debt is not created equal.

Seventy percent of students graduate with an average of $29,400 in student loan debt, according to a 2013 study by the Institute for College Access and Success. This level of debt can be scary, but it’s really the kind of debt that is important. For example, if you have high-interest debt in the form of credit cards or personal loans, pay those first. Be sure to avoid making costly mistakes that may cause your debt to pile higher, like missing repayments.

Being in debt is not always a bad thing, however. Debt that helps you increase your assets—like education to improve your career skills or purchasing property that is likely to increase in value over time—can help you get ahead faster if managed in the right way.

Let me explain: If you have a low-interest student loan (think less than 5%), then it might make sense to start investing before accelerating pay-off. Paying your loan off is like getting a guaranteed rate of return equivalent to the rate on your loan.

Guarantees are good, but they come at a cost that you need to judge based on your other goals. For example, by investing toward a safety net, you give yourself options in case of unexpected expenses.

Or, by investing toward a long-term goal, like retirement or building wealth, you may come out ahead because more years in the market give you more time for compound interest to work its magic.

However, student loan rates in more recent years tend to be higher (~6% to 8%). In this case, you are best to pay off your student loan first and invest as a second priority . Alternatively, you might consider refinancing your loan to a lower rate, if that’s an option.

Don’t leave free money on the table.

If your employer offers a 401k match or similar incentive, be sure to take it. You won’t get a similar return on your money anywhere else.

Here’s how to choose your retirement account.

In addition to your 401k (your employer-sponsored account), you can invest in an individual retirement account (IRA). For people starting out in their careers, a Roth IRA is a great idea. It keeps some flexibility should you need the money later—but it gives you the maximum tax advantage (because for now you’re paying so little tax on that money, it’s great to fund the after-tax Roth IRA).

When it comes to saving, retirement should always be among your top goals. The effects of compounding can be huge, so the earlier you start, the better. The amount you can put toward retirement will differ depending on your stage of life. People in their early 20s should simply aim to create savings habits, while those in their late 20s should aggressively save 20% of each paycheck.

One last thing: This is a personal issue.As with all things finance, money is deeply personal. If you sleep better at night knowing that your student loan is being paid down, then by all means do that first.

More from

Original Lifehacker article here