# leanprover-community/mathlib4 SLOC report

> leanprover-community/mathlib4: 1,605,717 code lines at commit c1ab78921dd5, counted with tokei-15.0.0 on 2026-11-16. Saved result d58deb2a4527a57de82df98161bcbf3c7ac7e67632d276603b6ad452bfc63df1.

leanprover-community/mathlib4 has 1,605,717 source lines of code out of 2,478,089 total lines across 9,397 files, counted with tokei from the master ref at commit c1ab78921dd5 on November 16, 2026. Tests, docs and generated files are excluded under OctoCounts' canonical public options.

OctoCounts produced this report by resolving leanprover-community/mathlib4 to commit c1ab78921dd5, downloading the repository source archive, and counting files selected by the effective rules with tokei, the open-source line counter written in Rust. The table below breaks the count down by programming language into files, total lines, code lines, comment lines, and blank lines, so the figures can be compared across languages and projects. Results are cached by commit, tokei version, and analysis options; an exact reproduction needs the same commit, engine version, and effective counting rules.

## Counting rules and retention

leanprover-community/mathlib4: tokei-15.0.0, policy directories-v1; docs excluded, tests excluded, generated excluded. Excluded directory names: .cache, .generated, .git, .next, __tests__, build, dist, doc, docs, documentation, fixtures, gen, generated, node_modules, target, test, tests, vendor. Ignored languages: none. Repository declarations: off. Exclusions are rule-based; they do not prove that every test, document or generated file was removed.

Saved reports remain subject to cache cleanup and replacement. Export the JSON or text for durable citation; live repository URLs can change.

## Repository size insights

This is a very large codebase by counted code lines. Code represents 64.8% of all lines, comments represent 17.5%, and the repository averages 171 code lines per file. Lean accounts for 99.4% of counted code.

| Language | Files | Lines | Code | Comments | Blanks |
| --- | ---: | ---: | ---: | ---: | ---: |
| Lean | 9,320 | 2,460,711 | 1,596,616 | 427,322 | 436,773 |
| Python | 25 | 8,630 | 6,817 | 518 | 1,295 |
| JSON | 3 | 1,162 | 1,162 | 0 | 0 |
| Shell | 9 | 749 | 510 | 138 | 101 |
| TeX | 2 | 379 | 321 | 0 | 58 |
| YAML | 1 | 239 | 231 | 7 | 1 |
| TOML | 2 | 72 | 40 | 27 | 5 |
| BASH | 3 | 30 | 20 | 3 | 7 |
| Markdown | 30 | 1,588 | 0 | 1,226 | 362 |
| Plain Text | 2 | 4,529 | 0 | 4,527 | 2 |

Top language: Lean 99.4%. Generated on November 16, 2026. Canonical report: https://octocounts.com/github/leanprover-community/mathlib4/commit/c1ab78921dd592c4e343e6eb0e6f798910726f62?reportId=d58deb2a4527a57de82df98161bcbf3c7ac7e67632d276603b6ad452bfc63df1&analysis=%7B%22profile%22%3A%22default%22%2C%22ignoredDirs%22%3A%5B%5D%2C%22includeDocs%22%3Afalse%2C%22includeTests%22%3Afalse%2C%22ignoredLanguages%22%3A%5B%5D%2C%22includeGenerated%22%3Afalse%7D

## Reproduce this report

[Reproduce this exact report and configuration](https://octocounts.com/github/leanprover-community/mathlib4/commit/c1ab78921dd592c4e343e6eb0e6f798910726f62?reportId=d58deb2a4527a57de82df98161bcbf3c7ac7e67632d276603b6ad452bfc63df1&analysis=%7B%22profile%22%3A%22default%22%2C%22ignoredDirs%22%3A%5B%5D%2C%22includeDocs%22%3Afalse%2C%22includeTests%22%3Afalse%2C%22ignoredLanguages%22%3A%5B%5D%2C%22includeGenerated%22%3Afalse%7D).

## Report FAQ

### How many lines of code does leanprover-community/mathlib4 have?

leanprover-community/mathlib4 has 1,605,717 lines of code, plus 433,768 comment lines and 438,604 blank lines, for 2,478,089 total lines at commit c1ab78921dd5 on November 16, 2026. Tests, docs and generated files are excluded under OctoCounts' canonical public options.

### How was the leanprover-community/mathlib4 line count measured?

OctoCounts resolved the public GitHub repository to commit c1ab78921dd5, downloaded the source archive, counted it with tokei, and cached the report by commit, tokei version, and analysis options.

### What commit was counted for leanprover-community/mathlib4?

This OctoCounts report was generated from master at commit c1ab78921dd5 on November 16, 2026.

## Similar repository reports

- [tristanbuckmaster/fluid_lean](https://octocounts.com/github/tristanbuckmaster/fluid_lean) — Lean, 1,578,291 code lines
- [yang-mills-group/OpenAI-YM-20261028](https://octocounts.com/github/yang-mills-group/OpenAI-YM-20261028) — Lean, 820,251 code lines
- [openai/NavierStokesAndEuler](https://octocounts.com/github/openai/NavierStokesAndEuler) — Lean, 533,712 code lines
- [openai/math](https://octocounts.com/github/openai/math) — Lean, 25,486,088 code lines
- [somamaley-ux/AASC-YangMills-Lean-Audit](https://octocounts.com/github/somamaley-ux/AASC-YangMills-Lean-Audit) — Lean, 98,115 code lines
- [wsdjeg/SpaceVim](https://octocounts.com/github/wsdjeg/SpaceVim) — Lua, 1,600,943 code lines

## Related OctoCounts pages

- [Recently analyzed repositories](https://octocounts.com/recent)
- [Popular SLOC reports](https://octocounts.com/popular)
- [Trending GitHub repositories](https://octocounts.com/trending)
- [Hall of Monoliths](https://octocounts.com/hall-of-monoliths)
- [How to count lines of code in a GitHub repository](https://octocounts.com/docs/count-lines-of-code-github)
- [GitHub SLOC counter guide](https://octocounts.com/docs/github-sloc-counter)
- [Counting methodology](https://octocounts.com/docs/methodology)
- [SLOC and code metrics glossary](https://octocounts.com/docs/glossary)
- [Original research: how filtering changes SLOC counts](https://octocounts.com/research)
- [OctoCounts API docs](https://octocounts.com/docs/api)
- [All OctoCounts guides](https://octocounts.com/docs)
