# cloc

> cloc counts blank lines, comment lines, and physical lines of source code in many programming languages

Source: https://talira.ai/catalog/cloc-g8028a91
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Command-line tool
- Categories: [developer tools / cli / code analysis](https://talira.ai/categories/developer-tools/cli/code-analysis)
- Platforms: linux, macos, windows, docker, cli[^6]
- Licence: GPL-2.0-or-later[^5][^6]
- Pricing: Free and open source[^5][^6]
- Free tier: yes[^5][^6]
- Self-hostable: yes[^6]
- Creator: Al Danial

cloc counts blank lines, comment lines and physical lines of source code in many programming languages, in files, directories, compressed archives and git commits. Given two versions of a code base it reports the differences, and it can sum results across runs and projects. It is a single self-contained Perl script with no dependencies outside standard Perl, with a Windows executable and a [Docker](https://talira.ai/catalog/docker-engine-9442r3nw.md) image too, and writes results as text, Markdown, SQL, JSON, XML, YAML or CSV. It is written by Al Danial and has been developed since 2006.

## Links

- GitHub: https://github.com/AlDanial/cloc

## Ways to install

### Package managers

- [WinGet](https://talira.ai/catalog/winget-g927bz13.md): <https://github.com/microsoft/winget-pkgs/tree/master/manifests/a/AlDanial/Cloc>[^1]
- [Homebrew](https://talira.ai/catalog/homebrew-djy17yn9.md): <https://formulae.brew.sh/formula/cloc>[^2]
- [APT](https://talira.ai/catalog/apt-d7essv0z.md): <https://packages.debian.org/stable/cloc>[^3]
- [mise](https://talira.ai/catalog/mise-0axr08xw.md): <https://mise-versions.jdx.dev/tools/cloc>[^4]

## Problems it solves

- how many lines of code are in this repo, broken down by language
- count only real code, not blank lines or comments, for a project estimate
- compare the size of two releases of our codebase line by line
- count the code in a tarball or zip file without extracting it
- get line counts per language as JSON or CSV for a report
- count lines of code at a specific git commit
- add up code size across several projects in one table
- a line counter that runs on Windows with no Perl installed

## Features

- counts blank, comment and code lines in many programming languages
- counts files, directories, archives (tar, Zip, .ear) and git commits
- diff mode between two versions of a code base
- sum results across runs and projects
- output as text, Markdown, SQL, JSON, XML, YAML and CSV
- read comment definitions for new languages from a file
- single self-contained file, no dependencies outside standard Perl
- Windows executable and Docker image

## Capabilities

- Has a command line tool: plan not known

## Trust

Overall: 0.67 out of 1.
Signals: maintenance 0.82, adoption 0.87, momentum 0.68, community 0.88, backing 0.20, extensibility 0.20.

- last commit 6 days ago
- 33 commits in the last 90 days
- latest release v2.12 11 days ago
- 23.7k GitHub stars
- 156 contributors
- accepts sponsorship (Github)
- created by Al Danial

## Alternatives

- [Tokei](https://talira.ai/catalog/tokei-15jd36ra.md): Count your code, quickly.

## Sources

[^1]: https://github.com/AlDanial/cloc/blob/master/README.md (checked 20 Nov 2026)
[^2]: https://formulae.brew.sh/api/formula.json (checked 21 Nov 2026)
[^3]: https://deb.debian.org/debian/dists/stable/main/source/Sources.xz (checked 21 Nov 2026)
[^4]: https://mise-versions.jdx.dev/tools.json (checked 21 Nov 2026)
[^5]: https://github.com/AlDanial/cloc/blob/master/cloc (checked 19 Nov 2026)
[^6]: https://github.com/AlDanial/cloc (checked 19 Nov 2026)
