Facebook's Magic Formula for Determining Your 9 Top Friends
Image: Michal Ludwiczak/Shutterstock


This story is over 5 years old.


Facebook's Magic Formula for Determining Your 9 Top Friends

Facebook’s algorithms are secret, but here’s what we can glean by paying attention to the clues.

We've all had that puzzling moment, when the random high school classmate you haven't talked to in decades or coworker from four jobs ago you literally forgot existed appears in the friends box on your Facebook profile, and you wonder what are they doing there.

My boyfriend never uses Facebook, and the two of us have never interacted on it except a few mutual events—no photos, comments, likes, tags, relationship status, nada. Yet when I asked him (for research purposes) to go to his profile page and look at who was in that box of nine friends highlighted on the left sidebar, there I was, right in the number one slot.


His response? "It's because you're creeping on me, stop creeping on me!"

Is it though? How Facebook ranks and orders our friends is an unsettling mystery. Most of us aren't in the habit of quantifying and organizing the people in our lives, and yet here a mysterious algorithm is doing it for us, beyond our control.

Who is "stalking" whom is one of the most private and sensitive pieces of information Facebook has

What's more, there's a sort of hunch proliferating through the social media collective consciousness that if someone you've barely interacted with is featured high up on your list of friends, you can deduce that that's your stalker, which would in turn mean the subject of your stalking could see you scoring prime real estate on his or her profile.

A cursory Google search turns up years' worth of anxious questions posted to forums like Quora and Reddit asking how Facebook orders our friend list, by folks worried the ranking can signal a one-sided relationship, frustrated that someone they dislike is persistently showing up on their page, panicking that their crush is going to figure out they've been stalking, or suspicious that their significant other is cheating because the some cutie is featured as a top friend.

"This girl i'm talking to keeps asking me about a few girls on my top 9 and I tell her I rarely talk to them and I have no clue as to why they pop up," asked one nervous redditor.


"My ex is there on second position, however we haven't spoken or I haven't checked her profile since december. I chatted witha lot of people before but why she's still there?" asked another poster on a forum.

There's no way to know the exact answers to these questions because details on Facebook's algorithms are secret. But there are some things we know about the factors that go into ordering our friend lists, and other insights we can glean by paying attention to the clues.

There are a few places on the platform where Facebook basically implies who your best friends are. If you click on "friends" on your profile, it'll list everyone in your network, with the people you interact with most closer to the top. A rotating sample of nine of those friends are highlighted on the left sidebar when you view your own profile page. Another group of names are chosen for your chat list on the right sidebar, and certain names autofill when you put your cursor in the search bar.

As you probably noticed, Facebook also recently introduced friend lists that organize your network into categories. Some lists are generated automatically, based on workplace or places you've lived. The "close friends" list is up to the user to populate, but Facebook gives suggestions for who you might want to put on there. It's a strange feeling; having a faceless force tell you the most important people in your life.

Much of the paranoia around this topic centers on the mysterious Box of Nine, the rotating sample of friends highlighted on your profile.


"Guys please help me here," posted one forum user. "Is the way that I see my friends' 9-boxes the same way they view it? And are the people I see in their 9-boxes the people they interact with privately/publicly? During the past few weeks I've been seeing that girl persistently on my boyfriend's 9-box. They never interact publicly, but she used to have a thing for him, so I'm scared."

Facebook told me this is a group of relevant friends intended to be a useful prompt for the user.

In other words, these are the people the algorithm is subtly encouraging you to interact with. Or if someone else is visiting your Facebook page, it's a sampling of people that person might want to connect with based on your mutual friends or interests. This makes sense: It's in the best interest of Facebook's ad-driven business model for us to connect and engage with as many people as possible. (With 1.5 billion users, clearly the approach is working.)

Friend ordering algorithms take into account how much you "interact" with certain people as well as how often and how recently. So the random high school acquaintance that's been popping up in your highlighted friends could be the algorithm gently nudging you to keep in touch with someone you've been friends with a long time. On the flip side, it may show you people you recently friended to jumpstart the connection, even if you haven't interacted yet. The formula also gives extra weight to people who recently posted stories or photos, the company says.


And sometimes, yes, it's simply random, Facebook told me.

Facebook's algorithms are also constantly evolving—this is the company's secret sauce and the ingredients are continually being tweaked to encourage engagement and promote new features. Until a couple years ago, Facebook used a friend algorithm called Edgerank. It looked at three factors to determine social proximity, affinity, weight, and decay: how much you interact, what kind of interactions, and how long ago.

The current formula is more complex. It uses machine learning and takes thousands of data points into account to determine people's social proximity. But assuming the basic tenets are the same, the equation likely weighs various types of interactions differently: Being tagged with someone in a photo or attending the same event is a better indicator that you're tight with them than liking a news story they shared or commenting on a wall post.

You can find some insight into the algorithm by scrolling through your activity log. Facebook tracks and records everything you do on the site, and if you browse through you can see all those little interactions you maybe forgot about, and draw a line between those and how the algorithm's ranking your friends. Those "random" folks showing up on your profile page or chat list may make a bit more sense.

I use Facebook pretty sparingly, so something as simple as a single comment or tag in the last year or even an accepted friend request was enough to push someone into the top 10 or 20. I sheepishly discovered that I had more of a data connection than I realized with a couple folks who I'd thought were maybe cruising my page—a passing comment here or there or membership in some of the same groups could boost their ranking.


Facebook has always claimed that its friend ranking algorithms take into account public interactions only, so no private chats or profile views. "Friends that show up in the Friends unit on profiles are not populated using any private information, like whether they've viewed your profile. Instead, we use a variety of public signals, like whether they've recently liked or commented on one of your posts, to choose which friends to show you there," a spokesperson told me.

"We use different rankings for different units (the Friends box on your profile page, the Chat list, etc). For each of those units we develop a ranking that works best for those products, but like the Friends box on profile, we don't use private info that the viewer couldn't find elsewhere (e.g, profile views)."

But that doesn't really pass the smell test for a lot of people. Of course Facebook is going to say that. Who is "stalking" whom is one of the most private and sensitive pieces of information Facebook has, and exposing it, even indirectly, could be disastrous for both the site and many users. It may sound trivial, but it's not. Facebook deals in the currency of personal relationships, and the fact that we don't know exactly how it's watching us or whether to trust it plays right into people's fears and insecurities.

To test the stalker question, I set up a dummy Facebook account, friended only me (the real me), and have been stalking the hell out of myself for several days. The dummy friend never showed up in any of my top friend lists on Facebook. I'll update this if it ever does.


I tried a few other (highly unscientific) experiments. I compared my friend list to my activity log to see what interactions I had with each person in the chosen nine, and watched how the order changed each day. The results were pretty logical. If I tagged people in photos or vice versa they'd climb higher up the list. After a few days of no interaction, they'd drop a few slots.

But some things were surprising. I found that the people I am prone to stalk were featured in certain places—not in the nine friends on my profile page, but in Facebook's suggestions for who I should include on my "close friends" list. My stalkees' names also appeared in the list of suggestions that autofilled when I typed each letter of the alphabet into the search bar (which are obviously going to skew toward the people you search for before, and will also include people you're not friends with but have viewed their photos or profile—remember, Facebook wants you to find these people and connect).

I also tested a tool built by developers that taps into Facebook's API to reveal your friend ranking. It was truly a mystery why some of the names in the resulting list showed up in that particular order, but the people I'd been creeping on definitely appeared higher up in this ranking. Even if we share some interests or groups, there was a very clear trend that the people I had been searching and looking at their profile and photos shot up the ranking list hidden in the source code.

The lower the number, the higher the social proximity. Facebook didn't say what data this calculation is based on, but judging from personal experience this list factors in profile views, private chats, and mutual friends other interactions.

The good thing is users now have a bit more control over which friends are featured on the page, and can influence it by giving Facebook feedback. Curating friend lists by labelling people "close friends," "family" and so on is a feature meant to give you more control over whose posts show up in your News Feed, but it's also bound to score those close friends better placement on your friend list. Conversely, categorizing someone as an "acquaintance" could make them less likely to appear in these featured slots. If you want to be super safe, you can go full on spy mode and create a fake account to do your stalking. Because make no mistake, Facebook is tracking that data.