How many lines of code are in the Linux kernel?

Technology hard Data from 2024

Guess before you scroll — the answer is below

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

The answer

40,000,000 lines

Roughly 40M.

The Linux kernel source tree runs to roughly 40 million lines, up from about 10,000 in Linus Torvalds’ first 1991 release. More than half of it is device drivers rather than core kernel code. Around 15,000 developers from 1,500 companies have contributed.

How to get close to this number

Place it between the two anchors this site gives you. A large game is tens of millions and a whole company's codebase is billions; an operating system kernel — one component, however central — belongs at the lower end of that range. Tens of millions is the answer, and bracketing between two known quantities is the most reliable method available.

The composition in the explanation is the key insight: more than half is device drivers rather than core kernel code. A kernel has to speak to every piece of hardware anyone has ever connected to a computer, and that support surface grows without limit while the core logic stays comparatively small. The same is true of any long-lived operating system.

The growth from about ten thousand lines in the 1991 release to tens of millions today is a four-thousand-fold increase, contributed by around fifteen thousand developers from fifteen hundred companies. That is the more remarkable statistic: a project with no single owner, coordinating contributions at that scale, for three decades, without the codebase collapsing under its own weight.

Where this number comes from

Source Linux Foundation / kernel source tree
Figure refers to 2024
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