Onboard to an unfamiliar codebase by quickly understanding its size and language composition.
Estimate effort and timeline for a rewrite or refactoring project by measuring total lines of code.
Generate metrics reports showing code volume, comment coverage, and language distribution for stakeholders.
Analyze git commits to track how much code was added or removed in a specific change.
cloc (Count Lines of Code) is a command-line tool that counts how many lines of source code are in a project. It breaks down the count by programming language and separates actual code lines, comment lines, and blank lines, giving you a clearer picture than a simple total. The problem it solves is simple but useful: when you inherit a codebase, want to estimate its size for a project plan, or need to report on how large a software system is, manually counting is impractical. cloc scans a file, directory, zip archive, or even a specific git commit and produces a neat summary table showing file counts and line counts per language. You would use this when onboarding to an unfamiliar project and want to understand its scale and composition, when estimating effort for a rewrite, or when generating metrics for reporting. It supports hundreds of programming languages and can be run on Windows, macOS, and Linux. It requires a Perl interpreter when running the source version, but Windows users can use a standalone executable with no dependencies. cloc is written in Perl and is a single-file command-line program.
Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.