How many lines of code does Google’s codebase have?

Technology brutal Data from 2016

Guess before you scroll — the answer is below

In lines. Thousands: 1.000 · Decimals: 1,5 · Millions: 9m.

The answer

2,000,000,000 lines

Roughly 2B.

Google’s codebase runs to roughly 2 billion lines, held in a single repository. Printed at 50 lines a page it would be a stack of paper about four kilometres tall. Thousands of engineers commit to it every day.

How to get close to this number

Scale up from a single product. A large application runs to millions of lines; a company operating dozens of large products plus the infrastructure underneath them, over two decades, accumulates two orders of magnitude more. Billions is the right scale for an organisation of that size with that history.

The single-repository detail in the explanation is the genuinely unusual engineering fact. Almost every organisation splits its code across many repositories; keeping billions of lines in one requires custom tooling that does not exist anywhere else, and the trade-off is that any engineer can change anything, with all the power and risk that implies.

The printed-stack comparison is the right way to make the figure physical, and it is the technique this site uses repeatedly: convert an incomprehensible count into a length, a duration or a mass. Note that the figure comes from a 2016 paper and has certainly grown since — it is the last public disclosure rather than a current number.

Where this number comes from

Source Potvin & Levenberg, Communications of the ACM
Figure refers to 2016
Last checked
Unit lines

Numbers move. If this one has drifted from its source, let us know.

Think you can do better?

Five fresh questions every day. No account needed.

Play today’s puzzle

Related questions