There is some irony in the fact that uncertainty is the only certainty in the stock market. The general long-term direction for the broader stock market is positive, but there will always be volatility and swings along the way. There are bear markets, bull markets, corrections, spurts, and market crashes, all adding to the stock market roller coaster ride.

After a great 2023 so far, stock market indexes like the S&P 500 are approaching all-time highs, bringing a bit of caution from some investors who may fear a crash is waiting on the horizon. Although nobody can say for sure if or when a market crash will happen, what you can do is be overprepared instead of underprepared.

One of the ways to prepare is to have stocks in your portfolio that can withstand these conditions. Below are two go-to stocks.

1. Berkshire Hathaway

Berkshire Hathaway (BRK.A -0.76%) (BRK.B -0.69%) is the cream of the crop when it comes to conglomerates, having amassed a market capitalization of over $770 billion (as of Dec. 5). This didn't happen by luck, either. Berkshire Hathaway, led by Warren Buffett and his team, has made strategic investments and acquisitions over the decades that have returned lots of value for the company and its shareholders.

Part of what makes Berkshire Hathaway a good buy to hedge a market crash is its vast portfolio. Apple accounts for more than 48% of its stock portfolio, so it's not the most diversified in individual stock weightings, but it still contains key companies from most major sectors. Below are a handful of examples:

  • Consumer staples: Coca-Cola
  • Energy: Chevron
  • Financials: Bank of America
  • Health Care: Davita
  • Information technology: Amazon

Having exposure to so many sectors (albeit skewed with its Apple investment) reduces the likelihood of Berkshire Hathaway suffering from sector-specific risks during market crashes.

Outside of its stock holdings' performances, Berkshire Hathaway has diverse wholly owned businesses, like insurance company GEICO and supply chain company McLane. Those two companies specifically are good businesses during down periods because their services remain in demand regardless of economic conditions.

This multifaceted approach of operational businesses and stock investments positions Berkshire Hathaway to weather most economic storms that come its way.

2. Microsoft

Microsoft (MSFT 1.82%) doesn't own stakes in dozens of public companies like Berkshire Hathaway or operate in multiple sectors, but it does cover as much ground within technology as any company. Microsoft first made its name through its Windows operating system, but has since built a world-class ecosystem of technology products and services.

Microsoft divides its business into three broad segments -- Productivity and Business Processes, Intelligent Cloud, and More Personal Computing -- but within those segments are plenty of products and services that have made great businesses:

  • Productivity and Business Processes: LinkedIn, Office products (Word, PowerPoint, Excel, Outlook, etc.), Dynamics
  • Intelligent Cloud: Azure, server products, Enterprise Mobility, various cloud services
  • More Personal Computing: Windows, Xbox and gaming, search and news advertising

Of the $56.2 billion in revenue Microsoft made in the fourth quarter of its 2023 fiscal year (ended June 30), no segment accounted for more than 43%. That's a major difference from other big tech companies that rely heavily on a few products or services and lessens some of Microsoft's risk in a market crash.

The main reason isn't necessarily the products and services themselves, but more so who's buying them from Microsoft: Other corporations. With employers using LinkedIn to recruit, PCs for the workforce, Office products for their operations, and Azure for their cloud services, a lot of Microsoft's money comes from other companies.

This helps Microsoft during market crashes because businesses are less likely to opt out of services during downturns than individuals are. Foregoing the newest smartphone model is far easier than canceling your cloud service that houses important company data.

Both companies have proven results

Both Berkshire Hathaway and Microsoft have been around for decades and survived all the downturns that have happened. Just recently, during the market downturn caused by the COVID-19 pandemic, both companies held up much better than the S&P 500 and have had better returns since the March 2020 bottom.

There's an inherent risk that comes with investing in individual companies during market crashes, but Berkshire Hathaway and Microsoft have shown constant resilience and adaptability. These are two companies you can feel safe holding in your portfolio for the long haul.