Ask a financial professional when the “best” time to invest is, and they’ll tell you: yesterday. Assuming you didn’t start yesterday, the next best answer is today.

That’s because compounding and time in the market (the stock market has historically trended upward over time, even if there are occasional set backs) are some of the most important factors for building wealth, writes Ellevest, a roboadvisor. The more time you have money in the market, the more time it has to grow (and recover from those occasional set backs).

Advertisement

That said, there are a few situations when it’s likely more financially prudent to put your money toward something else: “When you’re still working on getting your financial basics into place first,” writes Ellevest.

When you need to build your emergency fund

If you don’t have some cash set aside for an emergency, that should be your top priority. “That security is important because financial emergencies are practically guaranteed to happen sometimes,” writes Ellevest. And your investments aren’t liquid, meaning you can’t tap into them to cover emergency expenses without incurring some type of penalty or taxes (unless you’re taking out contributions to a Roth).

Advertisement

I’d add that if you fear you’re going to lose your job or another major, expensive life change is coming, it’s worth considering scaling your auto-contributions back slightly to build up your savings account if you haven’t yet. You don’t want to be without savings if you lose your job and don’t have an immediate replacement.

When you have to pay off debt

Paying off debt is always one of the trickiest financial goals to pair with investing. If you have a lot of student loan debt out of school, for example, you might feel that that’s your most urgent priority, and that investing should (and has to) take a back seat to paying that off. It’s understandable, but it also means you could miss out on years of growth.

Advertisement

Usually, the advice is to pay off debt and invest at the same time, without much more guidance. Ellevest looks at it slightly differently. “Pay off debt that has an interest rate above five percent,” it advises, “that’s historically been likely to cost you more than you’d otherwise earn by investing.”

So, if you have credit card debt, for example, prioritize putting more of your money toward paying that down than investing all of it. That’ll have a higher payoff (because your debt compounds, too).