Microsoft topped global market-cap rankings in 2021 before being overtaken by Apple in early 2022.
Microsoft's market capitalization briefly exceeded Apple's during parts of 2021, making it the world's most valuable publicly traded company at those points. Investors responded to growth in cloud computing, enterprise software, subscriptions, and productivity products such as Microsoft 365.
Microsoft's Azure cloud platform became an especially important part of the company's investment story. The company also owns Windows, LinkedIn, GitHub, Xbox, and a large professional-software business. Its shift from packaged software toward cloud services broadened recurring revenue.
Market-cap leadership can change without a company becoming smaller in absolute terms. If Microsoft's share price rises more slowly than Apple's, Apple can regain first place even while Microsoft reports strong results. Apple reclaimed the top ranking in January 2022 when it briefly crossed $3 trillion.