Lines of Code: What SLOC Measures and Where It Misleads

December 2, 2026

Reza Vatani

13 min read

A tall stack of glowing code bars next to a small stack with a green checkmark, illustrating that more lines of code does not mean more value
Lines of code, or SLOC (source lines of code), is the count of lines in a program's source files. It's the first number people reach for to size a codebase, and too often to judge how much an engineer produced. The first use is fine. The second got a lot worse once Cursor and Claude Code started writing a thousand lines in a minute. At Abloomify we read GitHub data for engineering teams every day, so here's how we think about it.

Key Takeaways

Q: What does lines of code mean?

A: Lines of code (LOC, or SLOC for source lines of code) is a count of the lines in a program's source files. Depending on the tool, it may include or exclude blank lines and comments. KLOC is the same count expressed in thousands of lines.

Q: How do you count lines of code?

A: Use an open source counter like cloc, tokei, or scc, which split each file into code, comment, and blank lines per language. For a quick estimate, git ls-files | xargs wc -l counts every physical line in a Git repo, comments and blanks included.

Q: Is lines of code a good productivity metric?

A: No. It rewards verbose code and punishes deletions, refactors, and careful reviews. It also breaks completely once AI tools like Cursor, Claude Code, or GitHub Copilot generate most of a diff. Use it to size a codebase or a pull request, not to rank engineers.

Q: How did AI coding tools change lines of code?

A: Generating lines became nearly free, while reviewing them did not. A team can double its line output and ship nothing extra if the new code sits in review or gets rewritten a week later. The useful question shifted to which lines were AI-assisted and whether they survived.

Q: What should engineering leaders measure instead?

A: Flow and outcome signals from GitHub and Jira: PR cycle time, time to first review, PR size, code churn, change failure rate, and deployment frequency. Abloomify combines these with AI-assisted vs human-written line data from Cursor, Claude Code, and Copilot, PII-free.

What are lines of code (SLOC)?

Lines of code (LOC), also called source lines of code (SLOC), is a software size metric that counts the lines of text in a program's source files, and it comes in two main flavors: physical SLOC, which counts every line in the file (sometimes minus blanks and comments), and logical SLOC, which counts statements regardless of how they're spread across lines. The difference matters more than it sounds. A single long if statement formatted over four lines is four physical lines and one logical line. A one-line JavaScript chain with three function calls is one physical line and arguably three logical ones. Two teams can report wildly different line counts for the same program purely because of formatting rules and what their tool chose to skip, so any comparison between codebases has to start with "counted how?"
Four quadrants showing how source lines of code are counted: physical lines, logical lines, comment lines, and blank lines
The terms you'll run into:
TermWhat it meansWhere you'll see it
LOC / SLOCLines of source code, usually excluding blanks and commentsCodebase size, repo stats
Physical SLOCEvery line in the file as it appears on screenwc -l, quick estimates
Logical SLOCExecutable statements or declarationsOlder cost models, some static analysis tools
KLOCThousands of lines of codeDefect density (defects per KLOC), estimates
Lines added / deletedChange in lines between two commitsPull requests, git diff, Git hosting stats
Most modern counters report physical lines split into code, comment, and blank, per language. That's usually the number people mean when they ask "how many lines of code is this project?"

How do you count lines of code?

The most reliable way to count lines of code is to run an open source counter like cloc, tokei, or scc against the repository, because these tools recognize hundreds of languages, separate code lines from comments and blank lines, and skip generated or vendored folders when you tell them to, which a raw wc -l will never do. cloc (short for "count lines of code") is the long-standing default and is written in Perl. tokei and scc are newer, written in Rust and Go, and much faster on large monorepos. All three give you a per-language table you can paste into a planning doc. For lines changed over time rather than total size, Git itself has what you need.
# Total size, split into code / comment / blank per language
cloc .
# Faster alternatives on big repos
tokei
scc

# Quick and rough: every physical line tracked by Git
git ls-files | xargs wc -l

# Lines added and deleted since a date (all authors)
git log --since="2026-11-01" --numstat --pretty=tformat: \
  | awk '{ add += $1; del += $2 } END { print "added:", add, "deleted:", del }'
Two things to get right before you trust the output. Exclude lockfiles, vendored dependencies, and generated code (node_modules, vendor, protobuf output, snapshots), or a single dependency bump will look like a heroic week. And decide upfront whether test code counts, because in a healthy codebase tests can be a big share of the total.

Is lines of code a good productivity metric?

Lines of code is a poor productivity metric because it measures how much text an engineer added, while the value of software comes from what that text does, and the two often move in opposite directions: the best change of the month might delete three files, while the worst one might add a thousand lines of duplicated logic that someone has to untangle next quarter. Edsger Dijkstra put it well decades ago when he argued that lines of code should be counted as "lines spent," not "lines produced." A line usually attributed to Bill Gates says something similar, comparing progress by lines of code to measuring aircraft building progress by weight. Both point at the same problem: code is a cost you carry, and more of it is not automatically more value.
Two panels showing a long wall of code with warning markers next to a short block of code with a green checkmark, both delivering the same feature, illustrating why lines of code is a weak productivity metric
The ways it goes wrong in practice:
  • It punishes deletion. One of the best-known stories from the early Apple Macintosh team is Bill Atkinson reporting "-2000" lines of code on a weekly form after a rewrite that made the code faster and smaller (Andy Hertzfeld tells it on folklore.org).
  • It rewards copy-paste and verbose patterns over a shared helper.
  • It ignores reviews, design work, incident response, and mentoring, which is where senior engineers spend a lot of their week.
  • It varies by language. The same feature in Go and in Python will not have the same line count, so cross-team comparisons are meaningless.
  • People game it the moment it shows up in a performance review. Nobody needs training for that.
We cover the broader set of signals in our guide to developer productivity metrics, including SPACE and DORA and where each one fits.

How AI coding tools broke the lines of code metric

AI coding tools broke whatever was left of lines of code as a productivity signal, because Cursor, Claude Code, and GitHub Copilot can now generate hundreds or thousands of lines from a short prompt, so line output now mostly tells you how much an engineer delegated to a model, not how much they built, and it says nothing about whether the generated code was correct, reviewed, or still in the codebase a month later. The trap I worry about most: line counts jump after an AI rollout, and leadership reads that as productivity before anyone checks review queues or rework. Some teams have even gone back to celebrating line output on dashboards, which is the oldest mistake in this field with a new coat of paint.
Here's what actually changes when a team adopts AI coding agents:
  1. Writing code gets cheap. Reviewing it does not. If the same three senior engineers review everything, a bigger volume of AI-written diffs lands on them and PRs wait longer.
  2. Diffs get bigger. A model will happily produce a 1,500-line PR that no human would have written in one go, and large PRs get skimmed instead of reviewed.
  3. Churn becomes the honest signal. Code that gets rewritten or reverted within a few weeks of merging shows whether the generated lines were right the first time. Our article on code churn explains how to read it.
  4. The split matters. Leaders want to know how much of the shipped code was AI-assisted and how much was human-written, and whether heavy AI users ship more or just push more lines.
That last point is where line data becomes useful again, as long as it's not used to score people. Abloomify imports usage metrics from Cursor, Claude Code, and GitHub Copilot, including AI-assisted lines vs human-written lines and acceptance rates, and sets them against engineering output from GitHub: PRs merged, cycle time, review health. The question becomes "did AI-assisted work reach production faster, and did it stick?" which is a question you can act on.

When lines of code is still useful

Lines of code is still useful when you're sizing something rather than judging someone: estimating how much there is to migrate, audit, or document, comparing a codebase with itself over time, tracking defect density per KLOC, keeping pull requests small enough to review, and spotting dead or duplicated code that nobody owns. I'll be fair to the metric here, because it gets more abuse than it deserves. If you're scoping a migration from one framework to another, the number of lines touched by that framework is a reasonable first estimate. If a service grew from 20 KLOC to 80 KLOC in a year with the same three engineers, that's worth a conversation about maintenance load, even if every line is good.
Places where line counts help:
  • PR size. Counting lines added and deleted per pull request is one of the cleanest predictors of slow, shallow reviews. Our guide on right-sizing diffs and WIP goes deeper.
  • Ownership and risk. A large module that only one person has changed recently is a bus-factor problem, and line counts help you find it.
  • Migration and audit scoping, where you need a rough size before anyone opens the files.
  • Trend lines for the same codebase over time, counted with the same tool and the same exclusions.
The rule I'd apply: lines of code can describe the code. It should never describe the person.

What to measure instead of lines of code

Instead of lines of code, engineering leaders should measure how work flows from first commit to production and what happens after it lands, which means PR cycle time, time to first review, PR size, review load per engineer, code churn, change failure rate, deployment frequency, and, now that AI writes a real share of the code, the split between AI-assisted and human-written work tied to those same outcomes. These signals come straight from GitHub, GitLab, Bitbucket, and Jira, so nobody has to self-report anything. They also hold up when a team adopts AI tools, because they measure delivery and stability rather than typing volume. The four DORA metrics cover the delivery side well, and PR flow metrics fill in the day-to-day picture.
Six indicator cards for PR cycle time, first review, change failure, code churn, AI vs human contribution, and deploy frequency, showing engineering signals to track instead of lines of code
A quick comparison of what each signal tells you:
SignalWhat it tells youWhere it comes from
Lines of codeHow big the codebase or diff isGit, cloc
PR cycle timeHow long work takes from first commit to mergeGitHub, GitLab, Bitbucket
Time to first reviewWhether reviews are a bottleneckGitHub, GitLab, Bitbucket
Code churnWhether merged code survivedGit history
Change failure rateWhether deploys break productionCI/CD and deploy data
AI-assisted vs human-writtenHow much shipped work came from AI toolsCursor, Claude Code, Copilot
This is what Abloomify's engineering productivity analytics are built around. It computes all four DORA metrics from GitHub, tracks PR flow and review health, separates human and AI agent contributions across code, PRs, and reviews, and shows whether heavy AI adopters actually ship more. It's privacy-first by design: the integrations read PII-free signals like PR timestamps and line-change counts, never code content, and Bloomy, our AI analyst, can answer "where is review getting stuck?" in plain language. The COO at one of our customers, a 50-person SaaS company that uses Abloomify for GitHub and Jira metrics, put the goal well: "What I did manually this week in a spreadsheet is exactly what I think Abloomify should be doing automatically." A line count was never going to be in that spreadsheet.
Count lines to size the code. Measure flow to understand the team.

FAQ

Is 500 lines of code a lot?

For a single pull request, yes. A 500-line diff is hard to review carefully in one sitting, and reviewers tend to skim big diffs. For a whole program, 500 lines is small: a script, a CLI tool, or one service module. Context decides it, which is exactly why raw line counts make a poor yardstick on their own.

Is 1,000,000 lines of code a lot?

For a single product team, a million lines is a very large codebase that nobody fully holds in their head. For an operating system, a browser, or a big enterprise suite, it is normal or even small. What matters more than the size is how much of it changes each month and how many people understand each part.

What is the difference between SLOC and KLOC?

SLOC means source lines of code, the count itself. KLOC means thousands of lines of code and is just a unit, so a 45,000-line service is 45 KLOC. KLOC shows up most in defect density, written as defects per KLOC, and in older cost estimation models.

Should engineers be measured by lines of code?

No. Lines of code rewards verbose solutions, copy-paste, and generated boilerplate, and it punishes deleting dead code, which is often the most valuable work an engineer does all month. With Cursor, Claude Code, and GitHub Copilot writing large diffs in seconds, individual line counts mean even less than they used to.

Does Abloomify track lines of code?

Abloomify reads line-change signals from GitHub, GitLab, or Bitbucket as context, next to PR cycle time, review health, and DORA metrics. It also imports AI-assisted lines and acceptance rates from Cursor, Claude Code, and GitHub Copilot. It never reads code content: only PII-free usage and output signals.
Share this article
← Back to Blog
Reza Vatani
Reza Vatani
Co-Founder & CAIO

AI-driven entrepreneur with a strong background in robotics and advanced analytics. PhD from Old Dominion University and former Product Development leader at Nasdaq Verafin.