Lines of Code

Lines of Code

"Lines of Code" is the simplest measure of the size of a computer program: you count how many written lines of text it consists of. As a measure of size, the number is useful; as a measure of performance or quality, it is notoriously unreliable.

At its core, a computer program is nothing more than text. People write it in a programming language, that is, a fixed language with strict rules that a computer can execute. This text is written line by line, one below the other, much like a poem or a recipe. Counting these lines gives you the figure known as “lines of code”. It tells you how extensive a program is. A calculator program for school assignments can get by with a few hundred lines. Large systems, such as a smartphone’s operating system, consist of many millions.

Why the number keeps popping up in the news

Lines of code are the only size measure for software that everyone immediately understands. That’s why companies and journalists like to fall back on it. When a carmaker says that a vehicle contains 100 million lines of code, the message is clear: the car is essentially a computer on wheels. Making such a statement requires no technical background at all.

Since AI systems have become capable of programming themselves, the number has taken on a new role. Large tech companies now report what share of their code was suggested by an AI. Such figures move stock prices, because investors use them to gauge how quickly the software industry is changing. For investors, the point is simple: if machines take over part of the work, costs and staffing needs shift accordingly.

At the same time, experts warn against this very number. More lines don’t mean more capability — often they just mean more baggage. Every line has to be maintained, checked, and eventually adapted. That’s why experienced developers regularly delete code without the program losing anything.

What exactly counts as a line

The problems start with the counting itself. Do you count blank lines? Do you count comments, meaning the explanations developers write into the text for their colleagues? The stricter variant is called “logical lines” and counts only actual instructions. Different counting methods can differ by more than a factor of two for the very same program.

Then there’s the programming language. Some languages need ten lines for the same task that others accomplish in one. A comparison between two projects in different languages therefore says almost nothing. It’s like comparing two books by page count when one is printed in large type.

Things get most skewed when lines are used as a performance measure for people. Someone paid by the line will write convoluted code. A short, elegant solution would then be a financial disadvantage. Experts call this a perverse incentive: the metric rewards exactly the wrong behavior.

From the school coding club to the corporate balance sheet

In everyday life, you first encounter this figure in programming itself. Editors, that is, the writing programs used for code, number every line along the left margin. Error messages refer to these numbers, for instance “error on line 47”. Without line numbers, hunting for bugs in large projects would hardly be possible.

In the business press, the number appears as a way to convey the scale of systems whose complexity would otherwise remain invisible. Examples include banking software, aircraft control systems, or government administrative systems. This often involves legacy systems that have been growing for decades and that hardly anyone fully understands anymore. The line count then serves as a warning sign for risk and cost.

The metric is also ubiquitous among AI tools for programming. Vendors advertise percentages of automatically generated code. A common mistake is to directly infer productivity from this. A more sensible question is whether the software ultimately works reliably and whether it can still be changed later on.

Subscribe free. Unsubscribe the second it sucks.

High-signal news across AI, business, UX, and tech. Every morning.