Many companies featured on Money advertise with us. Opinions are our own, but compensation and
in-depth research may determine where and how companies appear. Learn more about how we make money.

Money is not a client of any investment adviser featured on this page. The information provided on this page is for educational purposes only and is not intended as investment advice. Money does not offer advisory services.

Photo collage of ban, investing arrow, and graphic pie on one side of the seesaw, and graduation cap on the other side.
Franziska Barczyk for Money

Meme stocks, trendy cryptocurrencies (Dogecoin, anyone?) and GameStop’s newfound glory — investing isn’t the boring hobby it used to be. With so much hype, it’s only natural that more people want in on the fun.

But if you're one of the 40 million-plus adults with student debt, dipping your toes into the market is a classic “chicken or egg” scenario: do you aim to build wealth by paying off your loans quicker or by investing for your future?

Sure, the earlier you start investing, the more you can benefit from compound interest over time, but investing can also be risky, as the market can be a volatile place and you don’t want to make it even harder for yourself to pay off your debt if things go south.

You can balance the two goals, though, if you’re strategic about it. Here are some tips to help you decide where to put your spare cash.

What do your finances look like?

Student loans (or making money in the stock market) may capture more of your attention, but they shouldn't necessarily be the first financial goal you focus on. You have to start by taking an honest inventory of your finances, says Gregory Giardino, a financial advisor at J.M. Franklin & Company, a New York-based retirement planning company.

Ask yourself: do you have a stable income or does it fluctuate each month? Do you have an emergency fund? Are you contributing to an individual or an employer-sponsored retirement plan?

As a general rule, financial planners say you should have an emergency fund worth three to six months of non-discretionary expenses (aka enough to pay all of your essential expenses, plus any monthly financial obligations).

But if you’re a freelancer or your income fluctuates each month, Victoria LeBlanc, a certified financial planner at Raymond and James, recommends building a nest egg of at least 8 months’ worth of non-discretionary expenses before you invest.

If you want to maximize your savings, make sure you stash your money in a high-yield savings account or a certificate of deposit since these two offer higher returns than traditional checking or savings accounts.

While you’re adding to your emergency fund, you also want to build up your retirement savings, says Peter Lazaroff, chief investment officer at Plancorp, a St. Louis-based investment firm.

Employer-sponsored retirement plans are often the cheapest place to access a diversified set of investments for retirement, he says. Plus, in many cases, you’ll get some sort of matching for every dollar invested.

“So, take advantage of them,” Lazaroff says.

Start by contributing enough to your 401(k) to get your company match if you have one. Your long-term goal is to build up to saving 15% of your salary each year for retirement. If you don’t have a 401(k), aim to max out a traditional or Roth IRA, by contributing $6,000 a year. (IRAs are also a useful tool if you’re afraid you might need your savings for other purposes; for example, you can withdraw up to $10,000 for the purchase of your first home, without incurring a tax penalty.)

Then, the next step is figuring out how much money you’ve got left after meeting all of your basic financial obligations, including of course, making your minimum monthly student loan payments. If you find that you’re tight on money, then your best bet is to put any extra money that comes your way (think money from side gigs, tax refunds or bonuses) toward paying off your debt.

LeBlanc says to remember that although investing can earn you a higher return than what you currently pay on interest on your student loans, there is always the risk that you will lose money on your investments and still owe the debt.

In other words, investing is not a guaranteed money-maker, so you want to be on firm financial footing so you're better able to handle the inevitable ups and downs of the stock market.

How much are you paying on interest on your student loans?

If you’ve followed all the steps above and find that you have extra cash each month, then the real invest-or-pay-down-debt analysis begins. One rule of thumb to help you decide whether to prioritize paying off your student loans faster or investing focuses on interest.

Both Giardino and LeBlanc say you should compare the interest rate you’re being charged by your student loan lender versus possible investment returns.

Predicting investment returns can be tricky, but you can use history as a guide: Over the past 140 years, U.S. stocks averaged 10-year returns of about 9%, according to Goldman Sachs.

Analysts there predict that for the current decade, the S&P 500 will deliver average yearly returns of 6%. (Bonus tip: the S&P 500 is an index of the 500 largest companies on the stock exchange. If you invest in a single company or a handful, your individual returns could differ from the index at large.)

That’s why Giardino says that if the interest rate on your student loans exceeds 6%, then “it may make sense to tip the scale towards paying off student debt.”

Also, keep in mind the role that taxes play. With student loan interest, the tax codes can work in your favor, as you may be able to claim a deduction of up to $2,500 on interest paid. That essentially gives you a lower after-tax interest rate.

With stocks, it's the opposite. If you sell them, you’ll have to pay capital gains taxes on your earnings, which lowers your net gains. Most investors will pay a 15% or 20% tax rate on long-term capital gains. If you sell stocks (or other investments, like bonds or cryptocurrencies) within a year of buying them, then those are considered short-term profits and they are taxed at the same level as your income. Note that you may also owe state taxes on investment gains.

What type of student loans do you have?

Private student loans tend to have higher interest rates and offer fewer repayment options than federal student loans. That’s why Lazaroff recommends putting any extra money toward getting rid of private student loans before you invest.

But if you have federal student loans, and particularly if those loans carry an interest rate below 6%, then Lazaroff says there’s no harm in only making minimum payments until the debt is repaid and allocating any excess cash to other financial goals, like investing.

This is especially true if you’re in the Public Service Loan Forgiveness program, as you want to minimize the amount you pay so you can maximize the amount of federal debt forgiven at the end of the program.

The bottom line

There’s not a one-size-fits-all answer when it comes to deciding between paying off debt or investing — even experts disagree on which one should come first. Some argue that debt is like “handcuffs” and the sooner you can get rid of it, the better. Others think that you need to start investing as early as possible to not miss out on potential returns.

In the end, Lazaroff says that “the choice between paying down student debt or investing for the future doesn’t have to be a mutually exclusive decision. A mix of both can be the mathematically and emotionally optimal solution.”

If you are starting to invest, LeBlanc says to avoid stock-picking and day trading at all costs, especially if you’re on a budget. Instead, she says you should start with ETFs and low-cost mutual funds, as these will allow you to get moderate exposure in the market, plus can diversify your portfolio across different asset classes.

And finally, invest with a goal in mind, like saving money for a down payment or for retirement, says Patricia Hausknost, a California-based wealth planner, says.

“But don't do it just to play the market, on the off-chance that you get lucky and find another GameStop,” she adds.

More from Money:

11 States and Cities That Will Help You Pay off Your Student Loans

Millennials Aren't Having Kids Because It's Too Expensive

How to Get Student Loans Forgiven (With or Without Biden's Help)