It's easy to assume that a millionaire-making stock is a rags-to-riches story, a lottery ticket-style investment that hit it big. Sure, those stories exist, but the reality is that investors are most likely to get rich on a stock slowly.

To create riches, investors need to buy into successful companies that have proven they can grow, have a lot of room to keep growing, and are profitable enough to share profits with investors via dividends and buying back stock. These stocks will compound for years, making long-term investors remarkably wealthy if they are patient enough to let compounding do the work. They could even create a few new millionaires.

Here are three top technology stocks that meet the criteria just outlined and trade at attractive valuations today. They could help investors make millions over the coming decades, so consider buying and holding them.

1. Meta Platforms

Social media giant Meta Platforms (META -0.59%) has significantly outperformed the S&P 500 (^GSPC -1.11%) since going public in 2012. The company's stranglehold on social media, through Facebook, Instagram, WhatsApp, and Threads, helped it rack up over 3.29 billion daily active users. This massive audience created a digital advertising powerhouse because Meta tracks almost everything its users do and uses that data to serve them ads. The company generates over $156 billion in annual revenue, converting over $52 billion into free cash flow.

The company is investing billions of dollars in artificial intelligence (AI) for the future, but there's plenty of cash left. Meta initiated a dividend earlier this year and has repurchased enough stock to retire 11.5% of its outstanding shares over the past five years. That helps boost earnings per share and, thus, the stock price. Meta's core advertising business keeps growing, and the company's aggressive push into AI should eventually start showing returns.

Analysts estimate Meta will grow earnings by an average of 20% annually over the long term, making the stock a solid value at its current P/E ratio of 27. CEO and co-founder Mark Zuckerberg is still only 40, so a long-term investment is essentially a partnership with him. Zuckerberg has helped turn Meta into a trillion-dollar stock, so investors should be excited about the company's future in AI and whatever else Zuckerberg guides Meta to.

2. Alphabet

Google's parent company, Alphabet (GOOG -1.55%) (GOOGL -1.45%), built its company on internet search and used its success there to become a technology juggernaut. It makes billions of dollars on digital advertising through Google and YouTube, operates the world's third-largest (and rapidly growing) cloud computing platform, and has various interests in other spaces, such as the Android smartphone operating system, Waymo self-driving vehicles, Gemini AI, and quantum computing. Alphabet generates nearly $340 billion in annual revenue and over $55 billion in cash flow.

The stock has trounced the S&P 500 over its lifetime, and there's a good chance it will continue to do so. Alphabet is enjoying growth across the company and has enough cash to invest in AI and return profits to shareholders. It also initiated a dividend earlier this year and has bought back enough stock to lower its share count by 11% over the past five years.

Analysts expect the company to grow earnings by an average of almost 18% annually over the long term, a fantastic growth rate for a stock trading under 24 times earnings. Investors could be nervous about Alphabet's ongoing battle with government regulators in multiple countries; the company is facing antitrust lawsuits, which have already ruled Google a monopoly in search. But there are so many assets under Alphabet's umbrella that it's hard not to see the stock creating stellar long-term value for investors, whether together or pieced out.

3. Taiwan Semiconductor Manufacturing

It's hard to talk about AI without mentioning Taiwan Semiconductor Manufacturing (TSM -0.70%), the world's leading foundry (foundries manufacture semiconductors). Counterpoint Research estimates that TSMC (as it is often referred to) has a staggering 64% market share of global semiconductor production. Given how chips make AI possible, TSMC is arguably the most important company in the AI industry. Companies like Nvidia design AI chips but don't make them -- that's TSMC.

Since before AI, the general advancement of technology in society has driven growth in semiconductors. Today, the company generates nearly $83 billion in annual revenue and $26 billion in free cash flow. TSMC has generated the highest total returns of these three stocks since 2012. This is impressive because the company doesn't repurchase shares; returns have come primarily from organic growth. The company does pay a dividend that currently yields about 1%.

TSMC is poised to continue enjoying massive growth opportunities as the AI industry comes of age. Analysts estimate the company will grow earnings by an average of over 31% annually over the next three to five years, making the stock a bargain at 29 times earnings.

Investing in TSMC does carry geopolitical risks. China has long threatened to invade the company's home country, though TSMC is investing in building U.S. foundries to diversify its operations and try and mitigate those risks. Given the stock's growth outlook and cheap valuation, it could be a risk worth taking.