TL;DR — Quick Summary

Tokei counts code, comments, and blanks by language across your project. Blazing fast, accurate, and supports 200+ languages — the modern cloc alternative.

Tokei tells you exactly what’s in your codebase — how many lines of code, comments, and blanks in each language. It’s the fastest way to get a bird’s-eye view of any project.

Installation

# macOS
brew install tokei

# Arch Linux
sudo pacman -S tokei

# Cargo
cargo install tokei

# Ubuntu/Debian
sudo apt install tokei

Usage

# Count lines in current directory
tokei

# Output example:
# ===============================================================================
#  Language            Files        Lines         Code     Comments       Blanks
# ===============================================================================
#  TypeScript             43         4521         3892          214          415
#  CSS                     8          892          754           42           96
#  Astro                  29         2134         1876           89          169
#  JSON                   12          456          456            0            0
#  Markdown               15          234            0          178           56
# ===============================================================================
#  Total                 107         8237         6978          523          736

# Specific directory
tokei src/

# Filter by language
tokei -t=Rust,TypeScript

# Sort by code lines
tokei -s code

# Show per-file breakdown
tokei --files

# JSON output
tokei --output json > stats.json

# Multiple directories
tokei src/ tests/ scripts/

# Exclude paths
tokei --exclude '*.test.ts' --exclude vendor/

Comparison

FeatureTokeiclocsccloc
SpeedVery fastSlowFastFast
LanguageRustPerlGoRust
Languages200+250+200+200+
.gitignoreYesNoYesYes
Nested commentsYesSomeYesNo
JSON outputYesYesYesYes
ComplexityNoNoYesNo

Summary

  • Tokei counts code, comments, and blanks by language — blazing fast in Rust
  • Supports 200+ languages with accurate nested comment handling
  • Respects .gitignore by default, skips generated and vendor files
  • Export to JSON, YAML, TOML for CI/CD integration
  • Per-file breakdown available with —files flag