This page may be out of date. Submit any pending changes before refreshing this page.
Hide this message.
Quora uses cookies to improve your experience. Read more
9 Answers
Aaron Chiu
Aaron Chiu, Software Engineer at Facebook
The Android codebase is over 4 million and the main site without the backend code is 62 million.

Clarification: The new count includes the entire git repository: data, binaries, third-party and all. Thanks to Adam Hupp for pointing this out to me. The number is from running git ls-files | xargs cat | wc -l.
Your feedback is private.
Is this answer still relevant and up to date?
Joe Elyahchouchi
Joe Elyahchouchi, works at Coddict - Business Web Solutions
How do you define "Facebook"? Do you mean the site and mobile apps? Or just the Website? What about the in house application that Facebook uses to automate server administration, replications and the custom made memcached code, database code etc... do those count? If you were remaking facebook from scratch just as a regular website, you might be able to do it in 50 000 lines of code, but it would not at all scale to millions of people (if it scales to 100 it would be an achievement) most of the code and the achievement of facebook is being able to handle hundreds of millions of users without any lag crash or mistakes.

In short the answer is tens of millions of lines of code.
Your feedback is private.
Is this answer still relevant and up to date?
Evan Priestley
Evan Priestley, worked at Facebook
The site itself is around 9.2M lines as of a few minutes ago, but this excludes numerous backend services so the actual size is significantly larger. There are so many components that it would be difficult to accurately count everything, but the main site codebase is the largest by far so this is at least a reasonable order-of-magnitude estimate.
Your feedback is private.
Is this answer still relevant and up to date?
Olaoluwa 'Ola' Okelola
Olaoluwa 'Ola' Okelola, Facebook Engineer
A lot.

Facebook is composed of so many different components and so many different languages are used as evident in the responses to What programming languages are used at Facebook? Where is each one used?

I don't think anyone will be able to give you an absolute number. The best I can say is probably a few million but that's to be expected.
Vilan Natanzon
Vilan Natanzon, Internet Intellectualizer
See How large is Facebook's codebase? It's over 9 million lines.
Ashwin Dollar
Ashwin Dollar, lives in The United States of America

There’s not a good way to answer this as there isn’t a standard way to count lines of code, and what do you consider “Facebook”. I imagine you probably mean the core website (front end plus necessary back end logic). Keep in mind that Facebook had to make customizations to their database stack, so that should probably count towards their lines of code. They also wrote their own front end library, React, which is a bit harder to count as React is used by several other companies too and a lot of the code might not be used by Facebook themselves.

Facebook also likely has code specifically written for various teams to use internally (analytics, administrators to handle reported users/posts, etc), and code to make it easier to share necessary information with law enforcement (when you have billions of users, some likely will have legal issues), and code to comply with local regulations. Other code is likely not core to Facebook, but necessary to provide third party APIs and use Facebook logins.

Gaëtan Voyer-Perrault
Gaëtan Voyer-Perrault, Principal Engineer @ROBLOX, previously @Dynamic Signal & @Adknowledge
Sometimes the very question itself is more important that the answer. The problem with this question, is that it's not even clear how to count lines of code.

Let's run down the problem:
  1. What method do you use for counting? There are a few methods. (Source lines of code)
  2. How do you count open source contributions? Do you count the whole project or just the changes? What about forks? Facebook has their own version of MySQL, do they get to count all of its lines? (facebook/mysql-5.6)
  3. Whose code do you count? Are we including code written by the ops teams to back up systems? Map/Reduce code for the analysts? Custom ETLs for accounting?
  4. What code do you count? Public facing web site? Developer APIS? Various mobile apps? Advertiser APIs? Payments APIs? R&D code? Acquisitions (WhatsApp, Instagram, etc.)?