On this page
- What is lines of code (LOC, SLOC, NLOC)?
- How to count lines of code
- How many lines of code do popular repos have?
- Most files are short
- Is 20,000 lines of code a lot?
- What has the most lines of code?
- LOC vs function points
- Why LOC is a poor productivity metric and a good risk signal
- Count lines and find the risky ones with repowise
- How we measured
- FAQ
Lines of code (LOC) is the number of lines in a program's source files, the oldest measure of software size. Physical LOC counts every line; source lines of code (SLOC) and non-comment lines of code (NLOC) leave out blank lines and comments. Tools such as cloc, tokei and scc count them per language in seconds.
LOC is a good size measure and a bad productivity measure. This guide covers the definitions, the commands, and real numbers: we counted the production code in 160 popular public GitHub repos, so "is 20,000 lines a lot?" gets an answer from data, not opinion.
What is lines of code (LOC, SLOC, NLOC)?
LOC is a count of source lines. The variants differ only in which lines they keep.
| Term | What it counts |
|---|---|
| LOC (physical) | Every line in the file, including blanks and comments |
| SLOC (source lines of code) | Lines that contain code; blank and comment-only lines are excluded |
| Logical SLOC | Statements instead of lines, so a = 1; b = 2 counts as two |
| NLOC (non-comment lines of code) | Lines of code without comments or blanks; the term lizard and other complexity tools use |
| KLOC, MLOC | Thousands and millions of lines |
Scroll the table sideways to see every column.
Most "lines of code" numbers you see quoted are physical lines or SLOC, and the two can differ by a third or more in a well-commented codebase. Always say which one you mean, and whether tests, generated files and vendored dependencies are in the count.
How to count lines of code
The fastest accurate way is a dedicated counter: cloc ., tokei or scc in the repo root. Each splits code, comments and blanks per language and skips files your .gitignore excludes (cloc needs --vcs=git for that).
| Tool | Command | Notes |
|---|---|---|
| cloc | cloc --vcs=git . | Perl, the long-standing standard. --by-file for per-file counts, --exclude-dir=tests to drop folders |
| tokei | tokei | Rust, very fast, handles nested comments and embedded languages |
| scc | scc | Go, fast, adds a complexity estimate and a COCOMO cost estimate per language |
| Shell | git ls-files | xargs wc -l | Physical lines of every tracked file, comments and all; good for a quick total |
Scroll the table sideways to see every column.
To count lines of code in a git repo without a tool, filter by extension: git ls-files '*.py' | xargs wc -l | tail -1. To see how a count changed over time, check out an old tag in a worktree and run the same command there.
GitHub does not show a repository's total lines of code. The language bar on a repo page is computed from bytes per language by Linguist, and each file page shows that file's line count. For a total, clone the repo and run one of the tools above.
How many lines of code do popular repos have?
The median popular GitHub repo has about 79,000 lines of production code. The middle half runs from 32,000 to 203,000 lines, and 7 of 160 repos pass a million. We measured 160 public repos with 1,000+ stars in November 2026, counting non-comment lines (NLOC) in production files only: tests, generated code, vendored dependencies and tooling are excluded.
| Production lines per repo (n = 160) | Value |
|---|---|
| p10 | 14,832 |
| p25 | 32,274 |
| Median | 78,728 |
| p75 | 202,980 |
| p90 | 418,049 |
| Smallest | 5,404 |
| Largest | 2,642,894 |
Scroll the table sideways to see every column.
Some well-known projects in the set, production code only, snapshots from June to November 2026:
| Repo | Language | Production files | Production lines (NLOC) |
|---|---|---|---|
| gin-gonic/gin | Go | 58 | 5,404 |
| encode/django-rest-framework | Python | 70 | 11,651 |
| docker/compose | Go | 199 | 23,781 |
| knadh/listmonk | Go | 208 | 26,870 |
| paperless-ngx/paperless-ngx | Python | 486 | 77,893 |
| gohugoio/hugo | Go | 548 | 98,933 |
| django/django | Python | 783 | 131,550 |
| ollama/ollama | Go | 720 | 167,161 |
| go-gitea/gitea | Go | 2,295 | 274,685 |
| temporalio/temporal | Go | 1,701 | 307,257 |
| apache/airflow | Python | 4,344 | 614,541 |
| dbeaver/dbeaver | Java | 6,296 | 634,712 |
Scroll the table sideways to see every column.
Gin, one of the most used Go web frameworks, is 5,404 lines of production code. Django, a full web framework with an ORM, admin and template engine, is about 132,000. Popularity says little about size.
By primary language (repos with 10 or more in the set), the median repo has 94,427 production lines in Python, 86,459 in TypeScript, 55,484 in JavaScript, 38,358 in Go and 383,704 in Rust. Go projects in the set are the leanest; the Rust median is pulled up by large engines and toolkits.
Most files are short
Half of all production files are 64 lines or fewer, and only 2.1% pass 1,000 lines. Pooled over 200,715 files, p90 is 344 lines and p99 is 1,533. In the median repo, the largest 10% of files hold 47% of all the code, and the largest 1% hold 11.5%. A codebase is mostly small files with a short list of very large ones.
Is 20,000 lines of code a lot?
For a single developer, yes; for a popular open-source project, it is small. Only 23 of the 160 repos we measured (14%) have fewer than 20,000 lines of production code. Another 73 (46%) sit between 20,000 and 100,000, and 64 (40%) have more than 100,000.
| Production lines | Repos | Share |
|---|---|---|
| Under 20,000 | 23 | 14.4% |
| 20,000 to 100,000 | 73 | 45.6% |
| 100,000 to 500,000 | 51 | 31.9% |
| 500,000 to 1,000,000 | 6 | 3.8% |
| Over 1,000,000 | 7 | 4.4% |
Scroll the table sideways to see every column.
20,000 lines is roughly the size where one person can still hold the whole design in their head. It is a substantial side project and a full product for a small team. Past about 100,000 lines, nobody knows all of it, and documentation, ownership and tooling start to matter more than memory.
What has the most lines of code?
Among public codebases, the Linux kernel is the best-known giant: its source passed 40 million lines with the Linux 6.14 release candidates in early 2025 (Tom's Hardware), counting every line in the tree including comments, blanks and documentation. Google's internal monorepo was put at about 2 billion lines across its services in 2015 (Wired).
Questions like "how many lines of code is Windows 11", "Minecraft" or "ChatGPT" have no verified answer, because the code is closed and the companies do not publish a count. Figures that circulate online are estimates. For any open project, clone it and run tokei or cloc; you get an exact number in seconds.
LOC vs function points
Function points measure software size by what it does for the user, not by how many lines implement it. Allan Albrecht introduced them at IBM in 1979. An analyst counts inputs, outputs, inquiries, internal files and external interfaces, weights each by complexity, and sums them. The IFPUG maintains the standard counting rules.
| Lines of code | Function points | |
|---|---|---|
| Measures | Size of the implementation | Size of the delivered functionality |
| Depends on language | Yes, heavily | No |
| Cost to count | Seconds, automated | Hours, needs a trained counter |
| Available | Only once code exists | From requirements, before coding |
| Common use | Size, density metrics (defects per KLOC), complexity context | Estimation, contracts, cross-language productivity |
Scroll the table sideways to see every column.
"LOC and FP" in software engineering usually means this pair: two ways to size a system, one from the code and one from the requirements. LOC wins on cost and precision; function points win when you need to compare systems in different languages or estimate before any code exists.
Why LOC is a poor productivity metric and a good risk signal
Lines of code measure output volume, so they reward verbose code and punish deletion. As a productivity metric they backfire. As a signal of where risk sits inside a codebase, they work well. The best change to a file often removes lines, and a developer who writes the same feature in half the code has done better work, not less.
Inside a codebase, size points at complexity. In our data, 61% of files over 1,000 lines contain a function with a McCabe complexity above 20, against 3.6% of files of 200 lines or fewer. File health falls with size too:
| File size (non-comment lines) | Files | Median file health (0-10) | Has a function above 10 | Scores below 4 |
|---|---|---|---|---|
| 1 to 200 | 160,220 | 9.85 | 13.3% | 0.54% |
| 201 to 500 | 28,528 | 7.55 | 58.4% | 9.64% |
| 501 to 1,000 | 7,834 | 5.37 | 70.0% | 34.34% |
| Over 1,000 | 4,133 | 2.72 | 77.5% | 60.5% |
Scroll the table sideways to see every column.
File health is repowise's 0 to 10 code health score, and size and complexity are among its inputs, so the table shows how the score treats large files. The complexity column stands on its own: big files are where the hardest functions live. The code complexity guide has the full distribution, and the longest functions in popular repos shows what those functions look like.
Count lines and find the risky ones with repowise
repowise records the non-comment lines of every production file, scores each file from 1 to 10 for code health, and ranks the large, complex files that change often. Test, generated and vendored code is classified and kept out of the production numbers, so a repo's size and health describe the code that ships. The scores come from deterministic detectors with no LLM key (code health docs).
Open any indexed public repo to see it, such as django/django, or read how the scoring works on the code health feature page. To decide what to split first, the hotspot analysis guide pairs size and complexity with how often a file changes.
How we measured
Data comes from repowise's public per-file health data (production scope) for 160 public GitHub repos with 1,000+ stars and at least 50 scored production files, snapshots from May to November 2026. 200,715 production files, 32.6 million non-comment lines in total. A repo's line count is the sum of its scored production files' NLOC. Named repos are ones whose production file count matches their dependency graph's count, so the scope is comparable.
FAQ
- Is 20,000 lines of code a lot?
- It is a lot for one person and small for a popular project. Of 160 popular GitHub repos we measured, only 14% have fewer than 20,000 lines of production code, and the median has about 79,000. Around 20,000 lines is where one developer can still keep the whole design in mind.
- What has the most lines of code?
- Among open-source projects, the Linux kernel, whose source passed 40 million lines in early 2025. Google's internal monorepo was reported at about 2 billion lines in 2015. Closed products such as Windows do not publish official counts.
- How do I count lines of code in a git repo?
- Run
cloc --vcs=git .,tokeiorsccin the repo root for a per-language breakdown of code, comments and blanks. For a quick physical-line total, rungit ls-files | xargs wc -l. GitHub does not show a repository's total line count. - What is SLOC?
- SLOC means source lines of code: the lines that contain code, leaving out blank lines and comment-only lines. Logical SLOC counts statements instead of lines. SLOC is the usual basis for comparing sizes across codebases.
- What is LOC and FP?
- LOC (lines of code) and FP (function points) are two ways to measure software size. LOC counts the lines of the implementation; function points count the functionality delivered to users, from inputs, outputs, inquiries and files. FP is language-independent and can be counted from requirements before coding starts.



