# leanprover-community/mathlib4 SLOC report

> As of 2026-10-24 (commit 351f01871512), leanprover-community/mathlib4 contains 2,457,593 total lines: 1,591,548 code, 433,309 comments, 432,736 blank, across 9,333 files in 10 languages (top: Lean 99.4%). Custom configuration (tests excluded, docs excluded, generated excluded). Counted with tokei via OctoCounts.

leanprover-community/mathlib4 has 1,591,548 source lines of code out of 2,457,593 total lines across 9,333 files, counted from the master ref at commit 351f01871512 by the OctoCounts tokei engine on 2026-10-24. The report is cached by commit, tokei version, and analysis options, so recounting the same revision returns exactly these numbers.

OctoCounts produced this report by resolving leanprover-community/mathlib4 to commit 351f01871512, downloading the repository source archive, and counting every source file 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, so counting the same revision again reproduces exactly these numbers.

## Repository size insights

This is a very large codebase by counted code lines. Code represents 64.8% of all lines, comments represent 17.6%, 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,256 | 2,440,242 | 1,582,455 | 426,879 | 430,908 |
| Python | 25 | 8,590 | 6,785 | 512 | 1,293 |
| JSON | 3 | 1,187 | 1,187 | 0 | 0 |
| Shell | 9 | 748 | 509 | 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,573 | 0 | 1,212 | 361 |
| Plain Text | 2 | 4,533 | 0 | 4,531 | 2 |

Top language (Lean 99.4%). Generated at 2026-10-24T09:58:22.866201815+00:00. Canonical report: https://octocounts.com/github/leanprover-community/mathlib4

## Reproduce this report

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

## Report FAQ

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

leanprover-community/mathlib4 has 2,457,593 total lines, including 1,591,548 code lines, 433,309 comment lines, and 432,736 blank lines.

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

OctoCounts resolved the public GitHub repository to commit 351f01871512, 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 351f01871512 on 2026-10-24T09:58:22.866201815+00:00.

## Similar repository reports

- [tristanbuckmaster/fluid_lean](https://octocounts.com/github/tristanbuckmaster/fluid_lean) — Lean, 1,578,291 code lines
- [openai/math](https://octocounts.com/github/openai/math) — Lean, 22,600,394 code lines
- [FFmpeg/FFmpeg](https://octocounts.com/github/FFmpeg/FFmpeg) — C, 1,586,169 code lines
- [xai-org/grok-build](https://octocounts.com/github/xai-org/grok-build) — Rust, 1,584,555 code lines
- [nexu-io/open-design](https://octocounts.com/github/nexu-io/open-design) — TypeScript, 1,583,251 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)
- [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)
