explaingit

aldanial/cloc

Analysis updated 2026-06-21

22,970PerlAudience · developerComplexity · 1/5Setup · easy

TLDR

A command-line tool that scans any codebase and reports how many lines are code, comments, and blanks, broken down by programming language in a neat summary table.

Mindmap

mindmap
  root((repo))
    What it does
      Counts code lines
      Counts comment lines
      Counts blank lines
      Breaks down by language
    Tech stack
      Perl
      Single-file CLI
    Use cases
      Project size audit
      Effort estimation
      Codebase metrics
      Git commit analysis
    Audience
      Developers
      Tech leads
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Get a quick breakdown of a codebase by language when you join a new project

USE CASE 2

Estimate the size of a software system for project planning or effort estimation

USE CASE 3

Generate line-count metrics for a report on how large a product's codebase is

USE CASE 4

Count lines of code at a specific git commit to track growth over time

What is it built with?

Perl

How does it compare?

aldanial/clocbrendangregg/flamegraphso-fancy/diff-so-fancy
Stars22,97019,47318,017
LanguagePerlPerlPerl
Setup difficultyeasymoderateeasy
Complexity1/53/51/5
Audiencedeveloperops devopsdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Requires Perl on Linux and Mac, Windows users can download a standalone executable with no dependencies.

In plain English

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.

Copy-paste prompts

Prompt 1
Run cloc on my project folder and give me a summary of all TypeScript, JavaScript, and CSS files, excluding the node_modules directory.
Prompt 2
How do I use cloc to count lines of code at a specific git commit and compare it to the current HEAD?
Prompt 3
Show me the cloc command to scan a GitHub repo's zip archive without cloning it first.
Prompt 4
I want to generate a code count report that excludes test files and vendor directories, what's the cloc command for that?

Frequently asked questions

What is cloc?

A command-line tool that scans any codebase and reports how many lines are code, comments, and blanks, broken down by programming language in a neat summary table.

What language is cloc written in?

Mainly Perl. The stack also includes Perl.

How hard is cloc to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is cloc for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub aldanial on gitmyhub

Verify against the repo before relying on details.