Fast code statistics tool that counts lines, files, comments, and blanks grouped by programming language.
Tokei is a code analysis tool that generates statistics about codebases by counting files, total lines, code lines, comments, and blank lines grouped by programming language. It processes directories recursively and outputs formatted tables showing detailed breakdowns for each detected language.
The tool supports over 150 programming languages and can handle complex scenarios like multi-line comments, nested comments, and comments within strings. Tokei respects .gitignore files and provides additional filtering options through --exclude flags and .tokeignore files. It can sort output by various columns (files, lines, code, comments, blanks) and display individual file statistics with the --files flag.
Tokei offers multiple output formats including JSON, YAML, and CBOR for integration with other tools, and can read previously generated statistics files to combine results. The tool includes Docker support and functions both as a standalone CLI application and as a Rust library for programmatic integration.
# via Homebrew
brew install tokei
# via Cargo
cargo install tokei
# via APT
sudo dnf install tokei