This is the story of Facebook’s rapidly unfolding plan to take over the world, or at least the world wide web. It’s a tale that’s been hiding in plain sight for years, and it begins with an explanation of how Facebook has reached almost a billion users. It continues with a roadmap for how the seeds of Facebook’s future growth – to two billion and beyond – have already been planted. In both cases, what matters is emerging markets in Asia, Africa, and Latin America: the striving, proto-middle class “next billion” whose first impression of the internet is often that it seems to consist entirely of a site called Facebook.

By the end of this year, there will be more mobile phones on earth than people, and 73% of those phones will be something other than smartphones. Most of these phones have no data plan associated with them, and if they are capable of browsing the web at all, it’s through a protocol all but abandoned years ago in developed countries, known as WAP, which can only access websites specially tailored to it. By 2008, Facebook executives realized that one way to maintain its meteoric growth was to make it easy and free to access Facebook on devices like these, devices that in no way resembled the desktop computer for which it had originally been developed. And that’s where our story begins.

Africa, or how “Facebook Zero” took over an entire continent in 18 months

In May 2010, Facebook announced Facebook Zero. It is a simplified, text-only version of Facebook that can be accessed at 0.facebook.com if you’re in the right country and you’ve got the sort of WAP-enabled “feature phone” (i.e., non-smartphone) that comprises the majority of the phones on the planet.

Screen grab from YouTube user playonbed Promotion for Facebook Zero on a feature phone accessing the Sun Cellular network in the Philippines

When you first visit the site, you don’t see the standard Facebook homepage, only text. But the usual notifications are there, including friend requests, photos you’ve been tagged in, friends’ status updates, etc. Whether the phone has a keypad or a touchscreen, users can scroll through this river of text, click on links, send messages and do all the social things that Facebook is about.

Screen grab from YouTube user playonbed Facebook Zero on a feature phone accessing the Sun Cellular network in the Philippines

The trick is that Facebook Zero is free, benefiting from what’s known as zero rating by the phone companies. Accessing it doesn’t rack up any data fees, which are a big deal in emerging markets, where almost everyone is on a prepaid plan. (In countries in the developing world, the average monthly spend on mobile connectivity, which is often just voice and text, is 8-12% of the average take-home pay of a cell phone user, says Nathan Eagle, CEO of opt-in mobile ad network Jana.)

In the 18 months after Facebook Zero launched in Africa, the number of Africans on Facebook ballooned by 114%. It’s hard to directly link that growth to Facebook Zero, but it’s easy to see how they could be related. (In the 10 months since then, the number of users of Facebook in Africa grew only 18%.) In Kenya, which is typical for the continent, 99% of access to the internet is accomplished on mobile devices, almost all of which are either feature phones or even more basic models capable only of voice and text messaging. Facebook is now so popular in Africa that the site is driving the adoption of broadband internet, just so users can have faster access to all those pictures and status updates.

How does Facebook Zero come to be free to its users? Facebook spokespeople declined to comment for this article, including about whether or not the company is paying the mobile-phone networks in these countries for the prime status or the data those users consume. But Eagle, whose company reaches a large slice of its millions of users via Facebook Zero, suspects that Facebook isn’t compensating the networks at all.

This is because, for the telecoms networks, free Facebook represents a solution to an ever-present existential threat. Their first subscribers were relatively rich; the ones they are gaining now are ever poorer. So the revenue per user is shrinking. At the same time, the amount of data being pushed through their networks is increasing, and customers are demanding faster connection speeds, pushing up the cost of infrastructure. The networks are looking for ways to get more users, and make more money from each one of them.

“The fact is that Facebook has made a compelling argument to operators, which is ‘You should give Facebook away [to consumers] for free,'” says Eagle. “I don’t know how Facebook is making that case, but if I were Facebook, the argument I’d make is that Facebook is one of the most addictive things on the internet. If you have someone try out Facebook for the first time, it might lead them to want to try the rest of the web, and a lot of these other services they can charge for.”

The way Facebook Zero works is perfectly suited to convincing people who have never touched the internet to give it a try. First, there’s the inherent vitality of social networks–once your friends are on them, you’ll want to sign up too. And Facebook Zero makes it easy to invite friends who aren’t yet on the service, via text message. Once a user is hooked, the carrier has an opportunity to sell data services on top of Facebook Zero: loading text is free, but if you want to see pictures, you’ll pay the usual fees for data. The same goes for any external links a user follows while they’re browsing Facebook.

That logic would explain why Facebook was able to sign up 50 mobile carriers in 45 countries when Facebook Zero launched. And it can’t have hurt that making a domain like 0.facebook.com free on a mobile data network is easy, and required no special upgrades for most carriers. (Wikipedia, for example, recently launched its own effort to make a stripped-down version of its site available for free in developing countries.)

Asia, Latin America, and the competition

It isn’t only Africa where Facebook has cemented a hold. In the Philippines, says Eagle, “Facebook is literally becoming the internet.” At the end of 2011, according to Nielsen Research, a third of the country’s citizens were on the internet, or 33.6 million people. Today, the number of Facebook users in the Philipines is 29.4 million. The leading regional handset manufacturer, MyPhone, incorporates Facebook’s logo into its advertising, which includes a popular teen musical group that raps about Facebook in viral videos on YouTube.

MyPhone A music video promoting Filipino handset maker MyPhone

Of the 10 countries with the most Facebook users, six are emerging markets, and five of them—India, Brazil, Indonesia, Turkey, and the Philippines—represent 217 million Facebook users. The overwhelming majority are poor by the standards of the developed world, use feature phones that could not access Facebook before the dawn of Facebook Zero, and don’t have any other way to use Facebook.

But part of the challenge for Facebook is that though it has made impressive inroads in these markets, its competitors could come in at any time and, perhaps, offer the telcos an even better deal to make their social-networking services free to users. Twitter is already popular in many of these countries, especially the Philippines: having been designed from the outset to work with text-messaging (hence the 140-character limit on tweets) it’s uniquely suited to low-end devices. If Google wanted to, it could create a basic version of Google Plus. Orkut, an early competitor to Facebook that was acquired by Google, was more popular in Brazil until 2012. Perhaps this is also why Facebook doesn’t tout its success with Facebook Zero: It doesn’t want its rivals to pay too much attention.

The only place it doesn’t have to worry about—though it no doubt wishes it could—is China. There the battle has already been lost: the government blocks Facebook and other big foreign social networks, allowing a healthy ecosystem of homegrown (and thus more easily controlled) social media to develop.

How we got here: Facebook Zero, Facebook for Every Phone, Facebook for SIM

However, what might be most remarkable about Facebook Zero is that it’s only the earliest and most important component of Facebook’s strategy to conquer the developing world, and lock in the next billion users. It’s complicated enough that it requires a chart to make sense of it all.

Quartz How Facebook made itself accessible on every class of phone

Through a series of canny partnerships, acquisitions, and roll-outs, Facebook has made its service usable for anyone, whether they’re using the latest iPhone or a five year old gray-market Nokia with a black and white screen. In many cases, users don’t even have to have a data plan.

On the cheapest phones, of which there are a billion or more in the developing world, Facebook can now be accessed at little or no cost in at least two ways.

Gemalto Facebook for SIM

In one case, Facebook partnered with Dutch firm Gemalto to roll out Facebook for SIM, which puts a basic Facebook interface into the free space on a prepaid SIM card. The system interacts with Facebook’s servers through text messages, so it can work on any phone, but it requires that a user first purchase the modified SIM card. In Argentina, the first country to get it, Facebook for SIM is free for a trial period, then $9 per month. It even works on phones that don’t have data plans.

Fonetwish Facebook by Fonetwish, which runs on the USSD protocol

Facebook also rolled out, at the beginning of this year, something called Facebook by Fonetwish, developed by U2opia Mobile, a company based in Singapore. This is software that a mobile-phone carrier installs on its network; once it’s there, every subscriber can use it. Fonetwish uses a little-known protocol common to nine out of 10 phones on the planet, called USSD, to create a text-based interface for Facebook on even the most basic devices. Orange, one of the leading mobile carriers in Africa, rolled out Facebook by Fonetwish on a trial basis to 350,000 users in Egypt at the end of 2011, and has since reproduced that successful launch in Côte d’Ivoire. Orange owns 20 carriers in Africa, which represent 70 million customers.

For mid-range feature phones, which are the majority of the billions of phones on earth, Facebook can also be accessed at little or no cost in two ways.

Facebook Zero launched in 45 countries, but Facebook won’t say how many it has added since then. Regardless, it’s a safe bet that Facebook Zero is now accessible to hundreds of millions of people.

Mexico is the one developing country, out of the top 10 countries with the most Facebook users, where none of the carriers offers Facebook Zero. But the company has put just as much effort into another way to get Facebook in Mexico, and at far greater cost. In January 2011 Facebook rolled out, in partnership with a company called Snaptu, an app that could run on feature phones. Unlike Facebook Zero, which is always free, this app was free only for the first 90 days, after which users were charged the usual data fees. It was also more like the Facebook you probably know, displaying timelines, status updates and photos in a reasonable approximation of the way that Facebook looks on a smartphone.

Facebook Facebook for Every Phone, a Java app that runs in WAP browsers

Facebook liked the results of this partnership so much that just two months later, it acquired Snaptu for a reported $40 million or more, and rolled out its own app based on the technology, called Facebook for Every Phone. This app supports more than 2,500 devices, had 30 million users at acquisition, and is usable on around 80% of the phones worldwide.

It’s even possible that, unlike Facebook Zero, Facebook is making money on Facebook for Every Phone. The current business arrangements aren’t known, but before Facebook bought Snaptu, the two of them were sharing revenue with the carriers for data fees that the app’s users racked up on their phones.

Where Facebook is going: Android smartphones, total integration, commerce

Ultimately, though, Facebook’s efforts to get users on feature phones serve one central goal: to make sure those people keep using it when they buy smartphones, which they do as soon as they can afford it. The plummeting price of Android smartphones in the developing world — approaching $25 in some cases — is allowing Facebook users to quickly trade up their phones, or in some cases start directly with a smartphone.

With a smartphone, they can browse the same Facebook mobile website that’s accessible everywhere else in the world. Aside from language translation, Facebook doesn’t even bother to adapt its interface for different countries (unlike Microsoft, which tests different interface layouts and elements.)

Facebook is open about the fact that, having started as a service on desktop computers, it must now race to make itself truly mobile—witness the $1 billion it paid for Instagram, a mobile-based photo-sharing service with (at the time) 16 employees. And it isn’t just because Facebook’s existing users in the rich world are spending an ever bigger chunk of their online time on phones rather than computers. “We’re getting to the point now where the countries we’re going into … don’t have many computers at all,” said Eric Tseng, head of mobile products at Facebook, at a panel at GigaOm’s Mobilize conference. Facebook is so popular in some markets that half a dozen phones have a Facebook button right on their keypads.

HTC HTC Salsa “Facebook phone”

Once people are using the fully-fledged version of Facebook on such phones, the company can subject them to all of the number-crunching machinery that powers its advertising business. Facebook knows what we like, where we hang out, who our friends are, and even which websites we’re visiting when we’re not on Facebook.com. In the long run, the only obstacle to Facebook turning all that attention and data into revenue are concerns about privacy. Advertising may not even be the main way that Facebook makes money in the future–the firm is working on making it possible for merchants of virtual goods to sell subscriptions, from which it will undoubtedly take a cut, and is taking the first steps toward becoming a retailer. Micropayments for goods and services, already popular in some markets, are another possibility.

All of this could be far more profitable if Facebook is ubiquitous. “When people think about the open graph and Facebook APIs, they think about teenage girls in Kansas, when in reality if not now, quite soon the majority of Facebook users will be in high-growth emerging markets,” says Donald Fitzmaurice, CEO of mobile advertising and marketing firm Brandtone.

Facebook everywhere

Facebook is now available on hundreds of millions of mobile devices, and yet there’s still huge potential for it to grow further. There are 250 million Facebook users in Asia, more than on any other continent, and yet that’s just 6.5% of the population. In Africa, its penetration is less than 5%.

“In Vietnam, the number of Facebook users has tripled in the last six months, despite the fact that it’s illegal there,” says Eagle. He believes that the site could “easily double” its current global user base of nearly one billion.

And the key to Facebook’s strategy is that no matter where users start on the ladder of mobile technology, from the most basic device to the newest smartphone, Facebook becomes better and more fun to use as they upgrade. And this is also why carriers are so eager to partner with Facebook, because the next billion to come onto the internet will do it through a mobile device, on which every megabyte that they use in connecting with their friends can be measured and billed.

For the same reason that companies like Unilever are so keen to guarantee that the first shampoo a newly minted member of the global middle class ever tries is a brand they make, Facebook wants to completely own its users’ first contact with the web. The lifetime value of these users could, in the long run, be the main way for Facebook to justify its share price. And it gives Facebook, in a way that not even Google has accomplished, the chance to become the world’s homepage.