Bill Gates is among the most recognizable names in technology. The billionaire turned philanthropist is best known as the co-founder and longtime CEO of Microsoft (MSFT -1.73%), the company he helmed for more than 25 years, though he now spends much of his time focusing on charitable work.

Gates is currently worth $104.8 billion (as of this writing), according to Forbes, making him the world's 13th richest person. It's important to note that Gates has pledged that "the vast majority of my wealth would go toward helping as many people as possible."

To that end, he set up the Bill & Melinda Gates Foundation Trust. "Our mission is to create a world where every person has the opportunity to live a healthy, productive life," the Gates Foundation website says. By the end of 2023, the foundation had dispersed $77.6 billion since its inception, with a focus on "taking on the toughest, most important problems."

While the Trust continues to own stakes in 24 stocks in all, at the end of the third quarter, 80% of its holdings were represented by just four stocks.

A person looking at graphs and data on a see-though computer display.

Image source: Getty Images.

1. Microsoft: 27%

Given his deep ties to the company, it shouldn't be any surprise that Microsoft is Gates' largest holding by far. The Trust owns roughly 39 million shares of Microsoft stock worth about $12.4 billion (as of this writing).

There are a number of reasons Microsoft holds such a prominent place in the portfolio. In addition to the company's lucrative browser, software, and operating systems, Microsoft is the world's second-largest cloud infrastructure provider, with 20% of the market. It's also a key player in the field of artificial intelligence (AI). The two are inexorably linked, giving Microsoft a pole position in these important growth industries.

Management revealed that its Azure Cloud growth included "12 points from AI services," which is now a strong contributor to its growth. In fact, according to analysts at Evercore ISI, Microsoft's AI offerings could generate incremental revenue of $143 billion by 2027.

Microsoft has also been paying a dividend since 2004, which has increased every year since 2011. While the yield of 0.8% might seem paltry, it's supplemented a stock price that has soared 190% over the past five years (as of this writing). Given its payout ratio of just 25%, there are likely plenty more dividend increases to come.

With all that working in its favor, it isn't surprising that Microsoft represents such a large part of the Trust's holdings.

2. Berkshire Hathaway: 23%

Billionaire Warren Buffett, CEO of Berkshire Hathaway (BRK.A -0.39%) (BRK.B -0.56%), along with Gates, was one of the founders of the "Giving Pledge." Buffett said that "99% of my wealth will go to philanthropy during my lifetime or at my death." Thus far, he's donated roughly $43 billion to the Trust. That helps explain why the Gates Foundation owns more than 22 million Berkshire Hathaway shares worth more than $10 billion.

Given Berkshire's holdings, which include dozens of businesses and stocks, it's considered by many to be an incredibly safe investment. That, combined with Buffett's donations, shows why it's a top holding. Berkshire also racks up billions of dollars in dividend income every year and currently has $325 billion in cash.

Buffett is considered one of the world's most successful investors, which is likely why Gates continues to hold so much Berkshire Hathaway stock.

3. Waste Management: 16%

Waste Management (WM -0.49%) isn't an exciting business, but the combination of reliable recurring revenue and strong pricing power explains why it's a Gates favorite. The Foundation holds more than 32 million shares of Waste Management stock worth $7.1 billion.

Beyond its trash collection roots, Waste Management has been spending heavily on automation projects to make its recycling operations more profitable. The company's renewable natural gas projects are also bearing fruit.

Let's not forget Waste Management's dividend. The company has made dividend payments every year since 1998 and has increased its payout for 21 successive years. It boasts a yield of 1.3%, and with a payout ratio of just 45%, its track record of payout increases will likely continue.

4. Canadian National Railway: 13%

There's a lot to like about railroads, which offer a combination of cost-effectiveness and environmental benefits. Add to that the high barriers to entry and strong economic moat, and the attraction is clear. That helps to explain why the Gates Trust owns nearly 55 million shares of Canadian National Railway (CNI -0.67%) worth roughly $6 billion.

Canadian National is unique among its peers, as it's the only transcontinental railroad in North America, connecting the Pacific coast, the Atlantic coast, and the Gulf of Mexico. As a mode of transportation, rail is four times more efficient than over-the-road trucks. Not only are trains more cost-effective, but their greenhouse gas emissions are 75% less. There's also a strong economic moat and significant barriers to entry, which makes railroads even more appealing.

Canadian National has a dependable record of dividend payments, which has increased every year since the company's IPO in 1995. It offers a current yield of 2.2%, and its payout ratio of 39% offers plenty of opportunity for future increases.

MSFT Total Return Level Chart

Data by YCharts.

There's more

Along with the aforementioned reasons for Gates to hold these stocks in his Trust, there's another -- perhaps more compelling -- reason. Over the past five years, three of the four have generated triple-digit returns and outpaced the gains of the S&P 500, with Canadian National Railway being the sole laggard. That's partially explained by the recent macroeconomic conditions and the inflationary environment, which put a squeeze on the results.

However, viewed as a whole, the returns of Gates' largest holdings provide the clearest argument yet as to why these stocks are a wise choice.