Tech stocks have been the darlings of the market for quite some time now. Many have shot up in value over the past decade and made a lot of investors a lot of money along the way. In fact, tech companies now account for seven of the 10 most valuable public companies in the world. 

With all the success stories from tech companies, it's no wonder they tend to capture the attention of investors. Those looking for leading tech companies should look no further than these two.

1. Alphabet

Even while being valued at more than $1.7 trillion (as of Aug. 30), Alphabet's (GOOG -2.61%) (GOOGL -2.65%) stock in the past few years has reminded investors that it's still a growth stock at heart, and investors should be prepared for the volatility that comes with it.

Alphabet's value doubled in the 16 months from March 2020 to July 2021, dropped by over 39% in 2022, and has surged 51% this year.

Much of Alphabet's swings can be attributed to two things: the digital advertising landscape and artificial intelligence (AI) skepticism-turned-optimism.

Digital advertising is undoubtedly Alphabet's bread and butter. Google advertising and YouTube ads combined accounted for more than 88% of second-quarter revenue. As they go, so do Alphabet's top and bottom lines. Both segments grew year over year, but investors have been concerned about its slowdown from previous years. 

GOOGL Revenue (Quarterly YoY Growth) Chart

Data by YCharts; YoY = year over year.

While it's true that growth has slowed, it's along the lines of what you can expect from digital advertising's cyclical nature. When economic conditions like inflation put a strain on companies' pockets, digital advertising is one of the first budgets to get reduced. When things are booming, companies don't mind cutting bigger checks to spend on ads.

This is why I believe investors were shortsighted in their pessimism toward the company in 2022 and early 2023.

Regarding AI, the success of OpenAI's ChatGPT and the lackluster debut of Alphabet's generative AI chatbot, Bard, made many question whether the company could keep up in the AI race. Those concerns have since quieted, as it has released a handful of AI tools that should strengthen its advertising business.

Despite its 2023 surge, the stock seems to be fairly undervalued. Its price-to-earnings and price-to-sales ratios are both lower than digital advertising giant Meta Platforms and on par with the industry averages. For a market leader with the growth potential of Alphabet, that's a bargain worth considering for long-term investors.

2. Taiwan Semiconductor Manufacturing Company

Despite not being a household name by most standards, Taiwan Semiconductor Manufacturing Company (TSM -0.54%) is one of the most important tech companies in the world. It produces semiconductors and microchips that power some of today's most popular (and vital) consumer electronics.

Companies in industries such as technology, automotive, aerospace, healthcare, and renewable energy all make hardware products that require semiconductors, and TSMC (as it is commonly referred to) is one of the go-to options. This is primarily because of the foundry model it created, in which it manufactures chips specifically for a customer's needs instead of mass producing for general sale.

TSMC's revenue has struggled recently, down 13.7% year over year and 6.2% from the first quarter. But the worst of those problems should be behind the company for the near future. Not only is a chip shortage working itself out, but an AI-fueled boom should also give a spark to the company's finances. 

TSMC won't be dealing with AI directly per se, but clients that rely on its GPUs, processors, and other chips for their AI-driven operations -- like Nvidia and Advanced Micro Devices -- will. If Nvidia's recent 843% year-over-year net income growth is any indication of the chain reaction AI could have, TSMC will be good in shape. 

Unlike many other big tech stocks, TSMC offers an above-average dividend yield compared to the S&P 500. Its current quarterly payout is $0.46 per share with a trailing-12-month yield of around 1.9%. As the company works through its near-term problems and capitalizes on the AI domino effect, the dividend should provide investors with a steady income stream.