Esta página se muestra en inglés. Una traducción al español está en curso.
SkillsApr 6, 2026·2 min de lectura

Tokei — Fast Code Statistics for Any Language

Blazing-fast code statistics tool written in Rust. Count lines of code, comments, and blanks across 200+ languages. Perfect for project health reports and AI context. 12,000+ stars.

Listo para agents

Instalación con revisión previa

Este activo requiere revisión. El prompt copiado pide dry-run, muestra escrituras y continúa solo tras confirmación.

Needs Confirmation · 66/100Política: confirmar
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Tokei — Fast Code Statistics for Any Language
Comando con revisión previa
npx -y tokrepo@latest install e18416ca-e46b-4db6-b955-f485db46c8ed --target codex

Primero dry-run, confirma las escrituras y luego ejecuta este comando.

TL;DR
Tokei counts lines of code, comments, and blanks across 200+ languages in milliseconds, written in Rust.
§01

What it is

Tokei is a code statistics tool written in Rust that counts lines of code, comments, and blanks across 200+ programming languages. It runs in milliseconds even on large codebases and outputs clean tables showing the breakdown by language and file. It provides fast, accurate metrics for project health reports and AI context.

It is designed for developers, tech leads, and CI pipelines that need quick codebase metrics without the overhead of full static analysis tools.

§02

How it saves time or tokens

The token estimate for this workflow is 2,200 tokens. Running tokei in a project directory gives you an instant snapshot of codebase composition. For AI agents, this provides essential context (language distribution, project size) in a single command rather than manual file counting or guessing.

§03

How to use

  1. Install: brew install tokei (macOS) or cargo install tokei (any platform)
  2. Run tokei in your project directory
  3. View the language-by-language breakdown of code, comments, and blanks
§04

Example

# Install
brew install tokei  # macOS
cargo install tokei  # any platform with Rust

# Count lines in current project
tokei

# Output:
# ===============================================================================
#  Language            Files        Lines         Code     Comments       Blanks
# ===============================================================================
#  TypeScript             45         3420         2810          280          330
#  Python                 12          980          820           60          100
#  JSON                    8          450          450            0            0
# ===============================================================================
#  Total                  65         4850         4080          340          430
# ===============================================================================

# Exclude directories
tokei --exclude node_modules --exclude .git

# Output as JSON for programmatic use
tokei --output json

# Sort by lines of code
tokei --sort code
§05

Related on TokRepo

§06

Common pitfalls

  • Tokei counts by file extension; files without extensions or with non-standard extensions may be misclassified or skipped
  • Generated files (node_modules, build outputs) inflate counts; use --exclude to filter them
  • Comment counting accuracy depends on Tokei's language parser; some complex comment syntaxes may be miscounted

Preguntas frecuentes

How fast is Tokei compared to alternatives?+

Tokei is written in Rust and processes large codebases in milliseconds. It is significantly faster than tools like cloc (Perl) or scc (Go), especially on projects with thousands of files.

Does Tokei support my programming language?+

Tokei supports 200+ languages out of the box, including all major languages and many niche ones. Check the languages.json file in the Tokei repository for the complete list.

Can I use Tokei output in CI pipelines?+

Yes. Use the --output json flag to get machine-readable output. You can parse this in CI scripts to track codebase growth, enforce size limits, or generate reports automatically.

Does Tokei count generated code separately?+

Tokei does not distinguish between hand-written and generated code. Use --exclude to filter out generated directories like node_modules, dist, or vendor before running.

How do I install Tokei without Rust?+

On macOS use brew install tokei. Pre-built binaries are available on the GitHub releases page for Linux and Windows. You do not need the Rust toolchain for binary installation.

Referencias (3)
  • Tokei GitHub— Tokei is a fast code statistics tool written in Rust supporting 200+ languages
  • Tokei README— Supports JSON output for programmatic use
  • Tokei Comparison— Comparison of code counting tools
🙏

Fuente y agradecimientos

Created by XAMPPRocky. Licensed under MIT/Apache 2.0.

tokei — ⭐ 12,000+

Thanks for making codebase statistics instant.

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados