There isn't a lot that investors can know beforehand about a stock market crash except that it always catches Wall Street by surprise. You could say that this "shock" element is the defining characteristic of a crash, in fact, which only occurs when there's a dramatic downward shift in short-term earnings expectations.

No stock is immune to falling along with the wider market, of course. But there are some businesses that tend to do better through whatever tough selling environment that may come. Let's take a look at two of these sturdy stocks worth putting in your portfolio.

1. McDonald's

McDonald's (MCD -0.91%) has been selling its signature Big Mac sandwich for over 50 years and its dividend has been growing for about the same length of time. The fast food giant has hiked its payout in each of the last 47 years, in fact.

Streaks like these just aren't possible without some massive competitive advantages, which McDonald's clearly enjoys right now. A few of these include its dominant market share in a global industry, its pricing power, and its ownership of one of the most valuable brands on the planet. It also helps that Mickey D's can cater to a wide range of fast food fans through its value-priced menu and its more indulgent snacks, beverages, and meals.

McDonald's is adept at reinventing itself along with the changes in consumer preferences, most recently by boosting food quality and improving delivery and to-go speed. You can see evidence of its success in its blazing 9% comparable-store sales this past quarter.

The chain is putting up even more impressive earnings metrics as its operating profit margin moves toward 50% of sales. Investors should be happy to have a winning business like that in their portfolio, through market upturns and downturns alike.

2. Procter & Gamble

Don't look now, but you likely have several products in your home that were manufactured by Procter & Gamble (PG -0.78%). The company dominates consumer categories that are used by millions of people each day, including paper towels, laundry detergent, diapers, skin cream, and healthcare supplies. Demand for these consumer essentials doesn't typically dive during recessions, and shoppers tend to stick to the brands they've trusted for years.

None of this is to say that P&G is a recession-proof stock. The business has been posting weaker sales volumes lately, for example, as shoppers pulled back on purchasing frequency while prices were rising in 2023.

Still, P&G is winning market share in a tough selling environment. Its profitability stands well ahead of peers like Kimberly-Clark as well.

The company is highly likely to announce a decent boost to its dividend in April for its 68th consecutive raise, given expectations for strong earnings growth in the just-concluded fiscal year. Don't forget that P&G has paid a dividend since the '90s -- the 1890s, that is. This incredible streak reflects one of the big benefits of holding a prime market position in the consumer staples industry. It also suggests that shareholders will be happy to own this stock in a rally, or through the next surprise market downturn.