Image source:

Two of the most-visited websites on the planet are (NASDAQ:AMZN) and Facebook (NASDAQ:FB). Each has produced user and revenue growth over the past several years that led the companies to outpace the overall growth of the stock market. They now each have a market capitalization over $350 billion.

Investing in either company is an investment in its leadership, which in each case is the founder of the company. Jeff Bezos, Amazon's CEO, is notorious for sacrificing short-term profits for a larger piece of the pie in the long term. Mark Zuckerberg, who heads Facebook, commonly talks about his vision for the company 10 years into the future, even though tech is extremely difficult to predict that far out.

Each company saw its stock price fall after reporting third-quarter earnings recently, which may present a buying opportunity for investors. Let's look at the futures of each company and try to determine which is the better buy right now.

Margins under pressure

Amazon and Facebook are facing similar problems, which led to the market pushing down their stocks. Each company gave commentary indicating their profit margins will come under pressure over the next year.

Amazon CFO Brian Olsavsky told investors Amazon is making a step up in investments. It's spending twice as much on Prime Video content in the back half of 2016, expanding the number of fulfillment centers its opening, and spending heavily to support Prime's expansion to India. All of these expenses weighed heavily on its third-quarter profit margin and outlook for the fourth quarter.

Amazon is forecasting an operating profit between $0 and $1.25 billion in the fourth quarter. It generated $1.1 billion in operating profit last year. Olsavsky wouldn't provide guidance on operating income or expenses into 2017, but he noted that it takes over a year for fulfillment centers to ramp up to full operating capacity, putting additional pressure on margins.

Facebook, meanwhile, is preparing to experience slower revenue growth and higher expenses over the next year. During the company's third-quarter earnings call, CFO Dave Wehner told investors that it's nearing ad load saturation and expects revenue growth to slow meaningfully after the second quarter next year as a result. On top of that, he said Facebook plans to invest aggressively in 2017, resulting in significant growth in operating expenses -- particularly R&D expenses tied to acquiring top engineering talent.

Wehner wouldn't provide specifics around whether he expects expense growth to outpace revenue growth going into next year, but analysts generally interpreted his comments as a forecast for margin compression.

Growth and valuation

As mentioned, both companies are all about growth. Looking at their respective valuations makes that abundantly clear. Amazon stock is priced at 180 times its trailing earnings, and Facebook shares cost 58 times the company's trailing earnings per share. Looking at their price-to-sales ratio provides a slightly better picture, with Amazon trading for 2.9 times sales, and Facebook priced at 15.8 times sales.

Both are well above their industry averages, but both companies should be considered well above average.

Amazon is growing sales consistently in the mid-20s year after year, even as competitors move aggressively into e-commerce. Even large competitors with lower online sales bases, such as Wal-Mart and Target, can't match its online sales growth. Both brick-and-mortar competitors garner P/S ratios around 0.5, but analysts expect Wal-Mart to grow its revenue just 1% this year and for Target to see a nearly 6% sales decline.

Meanwhile, analysts forecast 52% revenue growth from Facebook this year and 35% next year. Its earnings are also exploding, with expectations for 77% growth in non-GAAP EPS this year, and another 28% growth next year. That's even factoring in some margin compression.

Facebook is trading for less than 24 times its 2017 earnings expectations despite 28% growth, making the stock look fairly valued based on its price/earnings-to-growth ratio. Interestingly, Amazon is trading for just 87 times its 2017 earnings expectation, and analysts expect its earnings per share to grow 89% year over year. As such, both have a PEG under 1.

Both companies are growing fast enough to support their monstrous valuations. While there are some question marks surrounding the margins of both companies, they're both well-positioned for long-term growth. But where Facebook's earnings and revenue growth are starting to slow meaningfully, Amazon's sales continue moving steadily higher and are expected to continue. That consistency makes it a better buy -- if only slightly -- in my book.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.