Sometimes you just want to know the shape of a codebase: how much code, in which languages, how much of it is comments. Tokei answers that in seconds. It's a fast code-counting tool that walks a project and reports lines of code, comment lines, and blank lines broken down by language - accurately distinguishing real code from comments and strings, and respecting .gitignore so it counts your code, not your dependencies.
The Shape of a Project, Fast
Point it at a directory and it prints a per-language table:
# Count the current project
tokei
# Sort by lines of code
tokei --sort code
# Machine-readable output
tokei --output json
Accurate and Quick
Tokei is genuinely fast - it processes large repositories in a blink - and its per-language accuracy (properly handling comment syntax and nested comments) makes the numbers trustworthy. The JSON and other output formats make it easy to drop into a script or a dashboard.
Rough Edges and Limitations
- Lines aren't value. It's a size metric, not a quality or complexity measure.
- Language detection edges. Unusual extensions occasionally need configuration.
- Generated code counts. Committed build output inflates totals unless excluded.
When you want a quick, honest sense of a project's scale and language mix, Tokei is the fastest way to get it.
Internal link suggestion: link "the shape of a codebase" to the onefetch post, which adds a git-flavored summary to the picture.