Before putting money into the stock market, it’s important to have a reasonably solid financial foundation. Investing can be an excellent way to participate in the growth of the U.S. economy and build long-term, real wealth, but money invested in stocks shouldn’t be money you may need to solve a short-term financial problem.

These aren’t absolute requirements that have to be perfectly satisfied before you begin investing. They’re better thought of as minimum financial readiness guidelines. Few people ever reach a point where every aspect of their financial life is perfect, and waiting for perfection could mean missing years of potential compound growth. The goal is simply to build enough financial stability that you can invest for the long term without being forced to sell at the wrong time.

At the very least, a good starting point is to eliminate high-interest credit card debt. Paying 20% or more in interest while hoping to earn investment returns in the stock market usually doesn’t make much sense. The return from paying off high-interest debt is guaranteed: every dollar of interest you no longer must pay is a dollar you keep. Lower-interest debt, such as a mortgage or some student or auto loans, are a different question and don’t necessarily need to be eliminated before investing.

It’s also wise to have an emergency fund. A common recommendation is enough cash to cover at least six months of necessary expenses. This money should be kept somewhere safe and readily available rather than invested in stocks. The purpose of an emergency fund is to prevent an unexpected job loss, major repair, medical expense, or other emergency from forcing you to sell investments during a market decline. Depending on job security, family responsibilities, and other sources of income, some people may be comfortable with less than six months while others may need more.

Another important guideline is to invest only money that you won’t need in the relatively near future. Five years is often used as a minimum time horizon, although a longer period is preferable for money invested primarily in stocks. The stock market can experience substantial declines that may take years to recover from. Money needed for a home down payment, a car, tuition, or another major expense in the next few years generally shouldn’t be exposed to that kind of risk.

To emphasize this, let’s look at the three major recessions since 2000. The first and longest is called the “Dot-Com Bust”, the second was the “Housing Crisis”, and the third was the “COVID Recession”.

Dot-Com Bust (2000)

The Dot-Com recession followed the collapse of the technology and internet-stock bubble that had built throughout the late 1990s. Investors had bid up the valuations of many technology companies to extraordinary levels, often with little regard for whether those companies were actually profitable. When expectations finally changed, the Nasdaq fell roughly 78% from its March 2000 peak to its October 2002 low, while the broader S&P 500 fell about 49% from its March 2000 peak to its October 2002 low. The recession itself was relatively mild by historical standards, but the stock market decline was severe, particularly for technology investors.

S&P 500 Dot-Com recession, beginning and end

Housing Crisis (2007–2009)

The Housing Crisis was considerably more serious. Years of rapidly rising home prices, excessive mortgage lending, and increasing financial leverage eventually produced a collapse in the U.S. housing market. As mortgage defaults increased, losses spread through the financial system, culminating in the failure or rescue of major financial institutions and a severe contraction in credit. The S&P 500 fell approximately 57% from its October 2007 peak to its March 2009 low, making this the most severe of the three downturns we’re discussing. The economy entered a deep recession and unemployment rose sharply, but investors who were able to remain invested eventually saw the market recover and move substantially higher.

S&P 500 Housing Crisis recession, beginning and end

COVID Recession (2020)

The COVID recession was dramatically different because the economic shock was extraordinarily sudden. As governments around the world imposed lockdowns and businesses closed in an effort to contain the virus, economic activity dropped at an unprecedented rate. The S&P 500 fell approximately 34% from its February 2020 peak to its March 2020 low—one of the fastest bear-market declines in history. The recovery was equally remarkable: massive fiscal and monetary stimulus, the reopening of the economy, and the rapid development of COVID vaccines helped fuel a powerful rebound. The S&P 500 recovered its previous high within about five months, illustrating that even a severe market decline doesn’t necessarily imply a long recovery period.

S&P 500 COVID recession, beginning and end

It’s important to note that all three of these recessions demonstrate a couple of truths about any kind of downturn in the market: The market always falls faster than it recovers, and it always rises to a point above where it was before the recession. Patience, and the ability to ride out a downturn, is key. You wouldn’t want to have invested in the market in January of 2020, and then find you needed the money in May and be forced to sell your shares at a loss.

Before investing, you should also have a realistic monthly budget and positive cash flow. In simple terms, you should consistently spend less than you earn. Investing should come from money that’s left after essential expenses, debt obligations, and regular savings needs are covered. If you need to borrow money or regularly use credit cards to make ends meet, investing in the stock market should probably wait until your finances are more stable.

For many investors, retirement savings should also be considered before or alongside a regular brokerage account. If your employer offers a retirement plan with matching contributions, failing to contribute enough to receive the full match may mean giving up part of your compensation. Opting-in to your employer’s 401k is like giving yourself a raise. Tax-advantaged accounts such as a 401(k) or IRA can also allow investments to grow with important tax benefits. You don’t have to be close to retirement to benefit from these accounts. In fact, starting earlier gives even relatively small investments more time to compound.

Finally, an investor should have at least a basic understanding of what they’re buying and why. You don’t need to be a financial expert, predict the next market move, or analyze individual companies to invest successfully. But you should understand that stocks can lose value, sometimes dramatically, and that a diversified investment held for the long term is generally less risky than concentrating a large amount of money in a few individual stocks. You should also understand the fees, taxes, and risks associated with the investments you choose.

The purpose of these guidelines isn’t to prevent people from investing until their financial lives are perfect. It’s to put them in a position where their investments can remain invested through both good markets and bad ones. Market declines are inevitable. The question isn’t whether the stock market will eventually experience another major downturn. The question is whether you’ll be financially prepared when it happens.

The basic test is fairly straightforward: Do I have expensive debt under control? Could I handle a financial emergency without selling my investments? Do I have money left over after meeting my regular obligations? And can I leave this money invested long enough to ride out a market downturn?

If the answer is yes, you may be financially ready to begin investing. That doesn’t mean you have to start with a large amount of money. One of the great advantages of investing is that you can begin participating in the growth of the U.S. economy with relatively modest amounts of money (like $500) and increase your investments as your financial situation improves. The most important thing is to build a financial foundation strong enough to allow you to remain invested for the long term.