Five years ago, Amazon (AMZN 3.43%) was more valuable than Apple (AAPL -0.35%). The e-commerce and cloud leader had a market cap of $821 billion, while the maker of iPhones, iPads, and Macs was worth $744 billion.

But today, Amazon is worth $1.64 trillion, while Apple has a market cap of $2.98 trillion. Let's see why Amazon fell behind Apple -- and if it might catch up and eclipse its market cap again by 2030.

An Amazon delivery driver checks a smartphone.

Image source: Amazon.

What happened over the past five years?

Amazon generates most of its revenue from its e-commerce marketplaces, but most of its profits come from its cloud platform Amazon Web Services (AWS). Both businesses experienced accelerating and decelerating growth over the past five years.

During the COVID-19 pandemic, Amazon's e-commerce and cloud growth accelerated as more people shopped online and more companies signed up for its cloud-based services. But it faced tough year-over-year comparisons after the pandemic ended, and both businesses struggled as inflation curbed consumer spending and rising rates forced companies to rein in their spending on cloud-based services. AWS also grew at a slower rate than its closest competitor, Microsoft's Azure, as the latter ramped up its investments in its new artificial intelligence (AI) features.

That's why Amazon's revenue growth decelerated over the past three years. Jeff Bezos' departure from the CEO role in 2021 also strongly suggested its high-growth days were over.

Metric

2019

2020

2021

2022

2023 (Forecast)

Revenue growth

20%

38%

22%

9%

2%

Data source: Amazon, analysts' estimates.

To make matters worse, Amazon's investment in Rivian backfired as the electric vehicle (EV) maker's stock plummeted over the past two years. That investment caused Amazon to post a whopping net loss of $2.7 billion in 2022.

Amazon still grew a lot faster than Apple

If Amazon matches analysts' expectations for 2023, its revenue will have grown at a compound annual growth rate (CAGR) of 17% from 2019. By comparison, Apple grew its revenue at a CAGR of 10% from fiscal 2019 to fiscal 2023 (which ended last September) as it also went through its own cycle of accelerating and decelerating growth.

Metric

FY 2019

FY 2020

FY 2021

FY 2022

FY 2023

Revenue growth

(2%)

6%

33%

8%

(3%)

Data source: Apple.

Apple's growth accelerated into fiscal 2021 as it launched its first 5G iPhones. But that upgrade cycle cooled off over the past two years -- and that slowdown was exacerbated by its persistent macro, competitive, and regulatory challenges in China.

Nevertheless, Apple's stock continued rising because its challenges seemed cyclical and its mountain of cash and marketable securities ($162 billion at the end of fiscal 2023) made it a safe-haven investment amid inflation and rising rates. Amazon held $64 billion in cash, cash equivalents, and marketable securities in the third quarter of 2023.

Apple also bought back 16% of its shares over the past five years, while Amazon's share count rose 5% during the same period. Apple only pays a tiny forward dividend yield of 0.5%, but Amazon doesn't pay anything at all. Those shareholder-friendly strategies likely made Apple a more compelling play for long-term investors than Amazon.

What could happen in the next six years?

Amazon's stock isn't cheap right now, at 44 times forward earnings. But looking ahead, analysts expect its revenue to rise at a CAGR of 11% from 2023 to 2025 as the macroeconomic environment improves. They also expect its EPS to grow at a CAGR of 33%.

Apple's stock seems cheaper at 29 times forward earnings. However, analysts only expect its revenue to grow at a CAGR of 5% from fiscal 2023 to fiscal 2026, and for its EPS to rise at a CAGR of 9%. We should take all of those estimates with a grain of salt, but Apple could certainly struggle if it doesn't diversify its top line away from the aging iPhone.

Amazon could continue to grow faster than Apple through the end of the decade, but its valuations are a bit stretched. If Amazon maintains its current valuations, matches analysts' expectations, and grows its EPS at a CAGR of 20% from 2025 to 2030, its market cap would reach $5.5 trillion by the final year. If Apple does the same thing and grows its EPS at a CAGR of 10% from fiscal 2026 to fiscal 2030, it would be worth $5.2 trillion.

Therefore, Amazon has a narrow path toward overtaking Apple again by 2030, but only if it stabilizes its e-commerce and cloud businesses. If either of those growth engines sputter out, its price-to-earnings ratio could plummet and prevent it from ever matching Apple's market cap. Apple's lower multiple, reputation as a safe-haven play, and constant buybacks arguably give it a much clearer path toward reaching a $5 trillion valuation.

A lot could happen over the next six years, but I suspect Amazon will still be worth less than Apple by 2030. Both stocks are still solid long-term investments, but Amazon simply faces more unpredictable challenges than Apple -- which can continue to leverage its scale, luxury appeal, and expanding ecosystem to lock in more consumers.