cloc
cloc is a cross-language command-line tool that counts blank, comment and physical code lines in directories, archives and Git projects.
What cloc measures
cloc identifies many programming languages and reports blank lines, comment lines and physical code lines separately. It can inspect individual files, directories, archives, Git repositories and selected revisions, then export results as text, CSV, JSON, YAML or XML. This makes it useful for inventorying a codebase, reviewing language composition and comparing versions with a fixed scope.
Windows package boundaries
The package listed here is a precompiled Windows executable and does not require a separate Perl installation. Put it in a stable tools directory and call it with an explicit path or add that directory to the user PATH. A source installation follows a different runtime path and should not be mixed with the single-file package when recording measurements.
Interpreting the numbers
Physical line counts are not a measure of complexity, quality or engineering effort. Comment markers inside strings, embedded languages, generated files and documentation strings can affect classification. A reproducible comparison records the cloc version, input scope, exclusions, command and date, then samples unusual language or directory results.
Maintenance note
This page was reviewed on 2026-08-23 against the cloc 2.10 Windows executable, supported output formats and known counting limitations. The archived item is a standalone Windows program rather than a traditional installer.
Save to your cloud drive
Open the cloud drive to get the file directly, or save it for convenient access on another device.
Quark Cloud Drive
RecommendedSave cloc to this cloud drive
Baidu Netdisk
Save cloc to this cloud drive
cloc Windows code counting guide
The Windows package is a single executable. Prepare a readable project directory and a consistent counting policy before running the first report.
Before you start
- Confirm that the file is a Windows executable and that the target project is readable by the current account.
- Decide whether reports may reveal private paths, repository structure or language composition before sharing them.
- { "Fix the scope first": "a complete directory, tracked Git files, selected extensions or a revision comparison should not be mixed." }
Installation steps
- 01
Place the executable in a stable directory
Put cloc-2.10.exe in a dedicated tools directory, optionally rename it to cloc.exe, and run a version or help command from PowerShell.
- 02
Choose a PATH policy
Use an explicit path for occasional checks. Add the tools directory to the user PATH only when repeated use justifies it, and keep the version visible in scripts.
- 03
Prepare exclusions
Identify node_modules, build output, vendored code and generated files. Record exclusions so later reports use the same scope.
Quick start
- 01
Count a project directory
Run cloc.exe with the project path and review file, blank, comment and code totals for each detected language.
- 02
Limit the input to tracked files
Use the version-control mode for a repository when caches, dependencies and untracked build output would distort the result.
- 03
Export a comparable report
Choose CSV, JSON, YAML or XML for archiving, and store the cloc version, command, exclusions and measurement date beside the report.
Usage tips
- Keep the cloc version, command and exclusions fixed when building a project trend.
- Choose between directories, archives, individual files and Git revisions according to the question being answered.
- Review strings containing comment markers, embedded languages and generated sources when classification looks surprising.
Troubleshooting and uninstall
Why are dependencies and generated files included?
Check the input directory and exclusion options, or switch to tracked-file mode. List the detected files before excluding a directory or extension.
Why is a language detected incorrectly?
Check file extensions and generated content, then use a language definition or explicit language option while preserving the command in a repeatable script.
- Remove the executable and reportsRemove the tools directory from PATH before deleting the executable. Keep reports and custom rules that are still part of project history.
Frequently asked questions
Does the Windows cloc package require Perl?
The precompiled Windows executable does not require a separate Perl installation. A source-based run has different runtime requirements.
Is a cloc line count the same as project effort?
No. It is a physical line metric grouped by language, useful for inventory and fixed-scope comparisons but not a direct measure of complexity, quality or effort.
Can cloc inspect ZIP archives?
It can inspect several archive formats, although some formats depend on an available extractor. If results look incomplete, extract a copy and compare the directory report.
Does the download require an extraction code?
The Quark entry does not require one; the four-character code for the Baidu entry is shown beside its download entry.