Alphabet (NASDAQ:GOOGL) (NASDAQ:GOOG) and Microsoft (NASDAQ:MSFT) are great stocks to anchor anyone's portfolio. These tech behemoths each generate tens of billions of dollars of free cash flow every year, and while they have long been large, well-known companies, their stock prices continue to deliver returns that make index fund investors jealous.

Here's why investors can feel confident buying these stocks today and well into the future.

A person planting dollar bills in a garden.

Image source: Getty Images.

Alphabet

More than 2.9 billion users depended on Google services such as Gmail, Calendar, and Google Docs last year. And with billions of people using the Google search engine every day, Alphabet is positioned to keep reaping the rewards as more and more advertising spending shifts to digital platforms.

Google shares what is essentially a duopoly in the global digital ad market with Facebook -- between them, they sop up around half of all digital ad spending. As more businesses turn to these channels to reach their consumers, digital ad spending is expected to increase from $378 billion in 2020 to $645 billion by 2024, according to Statista. 

YouTube will be a valuable asset for Google as it attempts to capitalize further on the trend, given that, for the period between Q4 2018 and Q4 2020, 70% of YouTube's advertising reached audiences that hadn't been reached by those brands' traditional TV ads, according to Nielsen's Total Ad Ratings.  

Advertising generates slightly more than 80% of Alphabet's total revenue. It is also a large player in the fast-growing cloud services market -- Google Cloud generates a small amount of revenue right now -- but advertising is the cash cow. Over the last year, Alphabet generated a whopping $58 billion in free cash flow

The growing business ended the second quarter with $136 billion in cash sitting on its balance sheet, and it is currently distributing some of that back to shareholders in the form of share repurchases. This should be a rewarding investment for many years.

GOOG Total Return Level Chart

GOOG Total Return Level data by YCharts

Microsoft

Microsoft, too, is highly profitable and should deliver reliable growth for your nest egg. It has built a solid brand around its core software services, such as the Windows operating system and the Office productivity suite. It recently raised the price for its Microsoft 365 subscription service, which includes access to workplace staples like Word and Excel. When a company has the ability to gradually raise its prices over time without losing ground, that's a sign of a strong competitive advantage.

While growth in digital ad spending is the fuel for Alphabet's economic engine, growth in data and mobile devices are key drivers for Microsoft's business. By 2030, 50 billion devices are expected to be online, and that just means more opportunities for data to be created and consumed. This should spell a long runway of growth for Microsoft's cloud services business, which is a solid No. 2 in market share behind Amazon. (Google Cloud is No. 3.) 

Across cloud services, Microsoft 365, and its Xbox Game Pass cloud gaming service, recurring revenue from subscriptions is a large part of what makes Microsoft is a great investment. One analyst estimates that 75% of Microsoft's revenue over the next year will come from subscriptions. 

Microsoft possesses all the traits of a sound investment. It has a stable base of recurring revenue and a strong brand, and its balance sheet is loaded with $130 billion in cash and equivalents. It also brought in $56 billion in free cash flow over the last year.  The stock should deliver reliable returns for many years.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.