tokei
Count lines of code by language, quickly and accurately.
Project: https://github.com/XAMPPRocky/tokei
Author: XAMPPRocky
Alternative to: wc (See 3 others)
Language: Rust
This page last updated:
tokei counts files, lines, code, comments, and blank lines across 150+ programming languages. It is significantly faster than cloc and handles edge cases like nested comments and comments inside strings correctly.
Features
- Breaks down results by language with code, comment, and blank line counts
- Supports 150+ languages and file extensions
- Handles nested comments and comments inside strings accurately
- Multiple output formats: JSON, YAML, CBOR for use in scripts and pipelines
- Works as a library for embedding in Rust projects
- Respects .gitignore and similar ignore files
Basic usage
# Count lines in current directory.
tokei
# Count lines in a specific directory.
tokei src/
# Output as JSON.
tokei --output json
Availability
Available on Linux, macOS, and Windows.