No one likes to think about a market crash, but the best way to stay afloat through such a time is to think ahead, plan, and be prepared. After all, crashes do happen. So if you're invested for the long term, you're likely to encounter one or more. But here's the good news. History shows us the market always recovers and then gains. If you invest wisely, you may limit your losses during tough times and go on to benefit once the market starts rising again.

So, how should you prepare? You could hedge against a market crash by choosing stocks that probably won't plummet during the worst of times and are sure to thrive over time. Market leaders and companies with either strong brand strength or products people can't avoid buying are good candidates. And that's why investing in healthcare giant Johnson & Johnson (JNJ -0.46%) and beverage powerhouse Coca-Cola (KO) could be a great idea. Let's find out more.

1. Johnson & Johnson

You may recognize J&J thanks to well-known products like Band-Aid bandages and Aveeno lotions, but these products actually are no longer part of the business. The company spun off its consumer health unit into a separate entity this year. But don't worry. J&J made the move because this unit had been weighing on growth.

J&J is likely to post higher overall growth thanks to revenue from its higher-growth pharmaceuticals and medtech businesses. By devoting its resources to these two areas, J&J may become more efficient and boost growth over time too.

Today, J&J sells many blockbuster pharmaceuticals across treatment areas, and even with the looming loss of exclusivity of its immunology drug Stelara, the company aims to increase pharmaceuticals revenue to $57 billion in 2025. That's almost a 10% increase from last year. J&J also is open to growth through acquisitions, and the sale of its consumer-health business gave it proceeds -- more than $13 billion -- to invest.

You also can count on J&J for dividends. The company is a Dividend King, meaning it's raised its payments for at least the past 50 years. It's impossible to predict a stock's performance during a crash, but we do know two things: You still can benefit from dividends no matter what the market is doing. And people need medical treatments regardless of the market context, a positive sign for J&J -- and its investors -- even during tough times.

2. Coca-Cola

Like J&J, Coca-Cola also is a Dividend King. The track record of both Coca-Cola and J&J shows dividends are important to these companies, suggesting they will continue their dividend policy. Of course, to continue dividend increases, a company must have sufficient free cash flow.

And here we can be confident about Coca-Cola. For most of the past decade, the beverage giant has generated free cash flow above $8 billion, and the financial metric generally has been on the rise. (The dip around 2018 came as Coca-Cola refranchised its bottling operations.)

KO Free Cash Flow Chart

KO Free Cash Flow data by YCharts.

Now, let's talk earnings. The world's biggest maker of non-alcoholic beverages sells not only the eponymous drink but also a variety of popular juices like Minute Maid, waters such as Dasani, and many other well-known products.

And Coca-Cola has demonstrated its brand strength during difficult times, such as the current market environment. Even as inflation weighed on costs and on the consumer's wallet, Coca-Cola reported growth in revenue and earnings per share in the most recent quarter -- and the company raised its full-year guidance.

All of this means that during a market crash, even if Coca-Cola shares fall, earnings still could hold up thanks to the company's brand strength and diversification across beverage types. As a result, any share-price declines may be short lived. And that makes Coca-Cola a top stock to buy to hedge against any future market crash.