Warren Buffett's Berkshire Hathaway has been a fortress stock during recessions and bear markets. Here's how
As investors head to the Berkshire Hathaway annual shareholders meeting this weekend, they can rest easy in a stock that's not only trading near all-time highs, but is also a safe haven during turbulent times.

Berkshire has a history of outperforming the S&P 500 during recessions, and performing especially well during bear markets, according to data from Bespoke Investment Group. Since 1980, Berkshire shares have beat the broader market over the course of six recessions by a median of 4.41 percentage points.

Even more impressive is the stock's performance during bear markets. During the same time period, the conglomerate outpaced the S&P 500 each time it dropped 20%, beating the broader index by a median of 14.89 percentage points.

For Warren Buffett, that reputation is no accident, but one that has been built over many decades by maintaining a long-term focus to steer investors through tough waters, and keeping conservative investments.

"[One] stock that has gained a reputation for safety is Berkshire Hathaway (BRK/A), and based on the last several decades, the distinction has been earned," read a Bespoke note from earlier this week.

Long-term focus

Known for his value-based investing style, the Oracle of Omaha makes long-term bets on companies that boast strong fundamentals and are likely to see future growth.

Among his notable winners over the years is Apple , which he started buying in 2016 and which has been compared with his legendary investment in Coca-Cola . The iPhone maker has outperformed throughout the bear market, similarly driving outperformance for Berkshire as Apple accounts for roughly 45% of the firm's portfolio, according to CNBC's Berkshire Hathaway portfolio tracker. It's also about one-quarter of Berkshire's market cap. Apple shares are up 27% this year.

"As goes Apple, so goes a good deal of Berkshire," Bespoke's Paul Hickey said.

That has helped Berkshire Hathaway Class A shares climb more than 4% this year. That's slightly below the S&P 500, but the stock is still trading near 52-week highs it reached just this week. On Monday, it reached $506,000 per share. It first crossed the half-million-dollar threshold last year.

For Berkshire shareholders attending this year's conference, the stock price performance proves the value of holding shares over a long period of time.

"The vast majority of the people that show up here are over the age of 60. That's who's gotten rich from owning Berkshire Hathaway," said Bill Smead, founder and chairman of Smead Capital Management and a Berkshire shareholder. "People held Berkshire Hathaway to a fault and they got that benefit."

To be sure, his wagers haven't always paid off. The billionaire investor notoriously sold all his airline stocks at the onset of the Covid-19 pandemic, which meant a loss to his investment.

A conservative stance

Buffett has also maintained a conservative stance. While that has meant he's sometimes underperformed during bull runs, it's what's helped the investor beat the market during periods of volatility.

Part of that has to do with his massive cash hoard. While Buffett's operating profits fell during the fourth quarter in 2022, his cash allocation grew to $128.651 billion, up from roughly $109 billion in the third quarter. In fact, Buffett said Berkshire will continue to hold a "boatload" of cash and U.S. Treasury bills.

"We will also avoid behavior that could result in any uncomfortable cash needs at inconvenient times, including financial panics and unprecedented insurance losses," Buffett wrote in his annual shareholder letter. "And yes, our shareholders will continue to save and prosper by retaining earnings. At Berkshire, there will be no finish line."

It also has to do with his long-held affection for insurance companies. The firms that are well-run constantly review their risks to remain profitable and are huge cash generators.

He first bought property and casualty insurer National Indemnity more than a half century ago, which helped produce cash for Berkshire's future ventures. Last year, he bought insurance firm Alleghany in an $11.6 billion transaction, a deal that was Buffett's biggest since 2016.

In the past, Buffett has called investing a "simple game," and that has proved out over his career. Berkshire has had a compounded annual gain of 19.8% from 1965 to 2022, compared with 9.9% for the S&P 500 during the same time.

"Buffett, throughout his career, has made a habit of going against the crowd, and that has served him well," Bespoke's Hickey said. "That's something that most investors, while they say they like to do that, they have a much harder time doing in practice."

— CNBC's Yun Li contributed to this report