Last year's stock market sell-off took a particularly heavy toll on the tech industry, and some of the world's most valuable companies experienced significant share price declines. The economically challenging environment highlighted the strength of some businesses and the weaknesses of others. During 2022, the tech-heavy Nasdaq Composite plunged by 33%, and only two companies among the five biggest names in tech outperformed the index.

AAPL Chart

Data by YCharts.

Apple (AAPL 1.77%) and Microsoft (MSFT 0.11%) delivered similar performances last year under economic strain, proving the reliability and resistance of their businesses. Since the start of 2023, their stocks climbed by more than 15%.

Apple and Microsoft both have histories of immense stock price growth over the long term, making them compelling investments. However, if you only have room for one in your portfolio, you'll need to know the better buy.

Apple

Apple shares are up by 274% over the last five years and 890% over the last decade. That growth has come alongside annual revenues, which have risen by 48% to $394 billion since 2018 while operating income increased by 68% to $119 billion. The company's development over the years is owed mainly to the potency of its products and services, which has led it to achieve a leading 24% global market share in smartphones with the iPhone. Its market share has steadily grown from 11.7% in the first quarter of 2019.

The company famously has created a "walled garden" of products, which includes smartphones, computers, tablets, smartwatches, and headphones, all of which are interconnected and all of which rely on its in-house operating systems. The interconnectivity of these devices gives users of Apple devices incentives to stay within its ecosystem when seeking out others devices and services. For instance, when an iPhone user needs a computer, they are far more likely to turn to Apple's Mac lineup than its competitor's, thanks to the connectivity's ease of use. For this reason, Apple was the only company among its biggest competitors to experience growth in its PC business amid economic headwinds in Q3 2022, expanding by 40.2%. Meanwhile, companies such as Lenovo, HP, Dell, and ASUS saw declines between 7.8% to 27.8%.

In 2023, Apple is expected to enter the virtual and augmented reality (VR/AR) market for the first time with a new headset. According to Statista, the AR and VR market is projected to reach $31 billion in 2023 and expand at a compound annual rate of 13.7% through 2027 to a value of $52 billion.

As a result, Apple's walled garden could boost the whole market and the mass adoption of mixed-reality devices while also providing substantial gains. 

Microsoft 

Microsoft also provided investors with substantial growth over the long term. Its stock is up by 199% over the last five years and 884% over the last decade. Meanwhile, the company's annual revenue climbed by 80% to $198 billion since 2018, with operating income rising by 138% to $83 billion.

Microsoft's success is largely thanks to its position as a software king. As the home to brands such as Windows, Office, Xbox, Azure, and LinkedIn, the company has used its software strengths to gain significant market share in operating systems, word processing, gaming, cloud computing, and social media. In fact, Microsoft's Windows held a 74% market share of operating systems as of January, and Azure had a 21% market share in cloud computing in Q3 2022.

Moreover, the company's growing position in artificial intelligence (AI) boosted its stock by 15% since the start of 2023. In 2019, Microsoft invested $1 billion in tech start-up OpenAI, the developer of ChatGPT. This advanced chatbot stunned the world with its ability to produce human-like prose when it publicly debuted in November 2022. The success of ChatGPT prompted Microsoft to invest a further $10 billion in OpenAI and begin integrating several of the start-up's technologies into its own platforms, like Azure and Office.

The AI market is projected to grow at a compound annual rate of 37.3% through 2030, and Microsoft stands to gain a lot from its development.

Is Apple or Microsoft the better growth stock?

As the world's most valuable and second-most valuable companies -- Apple's market cap is $2.5 trillion, while Microsoft's is $2 trillion -- these tech giants are pretty evenly matched. Both stocks would likely make assets to any portfolio, with their dominance continuing to offer considerable gains for years.

The decision on which is the better growth stock lies in which is currently a better value to get you the most bang for your buck. Apple's forward price-to-earnings ratio of 26.7 compared to Microsoft's 29.55 suggests the iPhone company offers more of a bargain. Then when considering both companies' price/earnings-to-growth ratios, a metric that also factors in expected earnings growth, Apple's 2.4 is again preferable to Microsoft's 6.8.

As a result, Apple's stock is trading at a better value and is the better growth stock to buy right now. However, keeping Microsoft on your radar for future investment is still a good idea.