Facebook (NASDAQ:FB) and Twitter (NYSE:TWTR) have defined the social media sector since its early days. The two companies together pioneered many of the social media concepts that have become part of the mainstream lexicon, including trending topics, the news feed, and even "liking" something. Both companies are also among the biggest and most important intermediaries in the world as they serve as a source of news and information for billions of people as well as a medium of communication between friends, family, and colleagues.

However, while Facebook and Twitter have much in common as social media companies, the two stocks couldn't be more different. Facebook started out relatively flat for the first 15 months following its 2012 IPO, but then enjoyed a five-year, roughly 800% stock price surge. It's become one of the world's most valuable companies as it built a near-monopoly in social media with the help of Instagram and WhatsApp, which it acquired in 2012 and 2014, respectively.

Twitter, on the other hand, enjoyed a 66% surge in the first few months following its 2013 IPO but has mostly floundered since then as a publicly traded company. It's had numerous issues finding a reliable business model and growing its user base. The chart below shows how the two companies' paths have diverged over the past 5 years.

FB Chart

FB data by YCharts.

Facebook has been no stranger to trouble over the last two years as it has dealt with a series of scandals, while Twitter has shown some signs of progress in its turnaround efforts. Let's take a look at where each company stands today to see which is the better buy.

A tech giant at a crossroads 

Facebook's business has size, reach, and profitability that's essentially unrivaled in the world. As of its most recent quarter, the social network had 2.38 million monthly active users (MAUs) and its family of apps -- including Instagram, WhatsApp, and Messenger -- had 2.7 billion MAUs.

The advertising business built on its social network is also incredibly profitable with an adjusted operating margin of 42% in the first quarter and 45% last year. 

Numbers like those illustrate Facebook's dominance and help explain why it's market cap is nearly $550 billion. That same dominance, however, has led to a slew of challenges.

A line of young people looking at their phones.

Image source: Getty Images.

The company is under scrutiny following a series of scandals related to the 2016 presidential election, and critics have attacked it for undermining democracy, facilitating hate speech, and even contributing to the genocide of Rohingya Muslims in Myanmar. As a result, #DeleteFacebook campaigns have spread across social media, amplified by celebrities like actor Jim Carrey.

Many have called for increased regulation and corporate oversight of the company and of founder Mark Zuckerberg, who controls a majority of the company's voting rights. Some want him to relinquish either his CEO or Chairman role. Presidential candidate Sen. Elizabeth Warren, D-Massachusetts, has even called for Facebook to be broken up, along with other big tech companies like Amazon and Alphabet. The threat of a breakup seemed to increase in early June when the Federal Trade Commission said it would open an antitrust probe against Facebook, which follows Facebook's setting aside $3 billion to pay an expected FTC fine that could reach $5 billion. Zuckerberg has repeatedly pushed back against claims that the company is a monopoly, telling Congress "it certainly doesn't feel like that to me" in 2018 testimony. 

In response to the privacy and security-related criticisms, Facebook has ramped up hiring in an effort to make its site less vulnerable to Russian manipulation in the next presidential election and to prevent data misuse like that which occurred in the Cambridge Analytica incident. Those efforts have been costly, however, and the company expects profitability to decline as it implements new safety and security protocols.

Later in June, Facebook reminded the market of its power to make an impact when it announced a new digital cryptocurrency called Libra that marked a major foray into digital payments. That, along with initiatives like Instagram e-commerce, show that the company has plenty of options to add new business lines.

A surprising comeback

Just a couple of years ago, Twitter looked like it could drift into irrelevance. The company had seen rapid turnover among its executive ranks. When CEO Jack Dorsey returned to the executive chair in 2015, revenue was declining and the company's user growth had flatlined. Meanwhile, investor attention moved to Snapchat-parent Snap and Instagram, as young people seemed to be turning their attention to photo-based social media apps.

However, Twitter has steadily made improvements to its platform, making efforts to eject bad actors off the site and tame hate speech. It has also benefited from things outside of its control, like President Trump's embrace of the site to announce news and policy and Facebook's challenges. Twitter has taken advantage of the situation to return to growth.

In the company's first quarter of 2019, revenue grew 18%, a sign of Twitter's improving advertising business, and monetizable daily active usage (mDAU) increased by 11%. Revenue in the U.S. was up 25%, demonstrating the company's ability to extract greater income from a user segment that was thought by some to have reached maturity.

Twitter has also become solidly profitable, posting a profit on a generally accepted accounting principles (GAAP) basis of $190.8 million, or $0.37 per share on a non-GAAP (adjusted) basis. Its market cap stands around $26.6 billion.

As a result of those investments and commitments to improve the health of the business and focus on its core user base, Twitter now appears to be on more solid ground than it has been in a long time. The company will never be the behemoth that Facebook is, but the site is a valuable tool for those who depend on it, and management is clearly doing a better job these days of unlocking value.

Who's the winner?

Twitter deserves credit for its recent turnaround, but it's hard to match Facebook's set of competitive advantages, which have made life difficult at times for its smaller rival.

Size matters in social media, as advertisers are usually interested in reach and audience, giving an advantage to Facebook. In addition to being much larger than Twitter, Facebook is also growing faster, with revenue up 26% in its most recent quarter compared to 18% for Twitter. On the other hand, Twitter is the cheaper of the two stocks at the moment with a price-to-earnings ratio of 20 compared to Facebook at 28.5. 

While Twitter looks like a much healthier business than it was a few years ago, Facebook's network of competitive advantages, profitability, and ability to launch new businesses make it the better buy today.

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.