# 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. ## Install Save as a script file and run: ## Quick Use ```bash # Install brew install tokei # macOS cargo install tokei # any platform # Count lines in current project tokei # Output: # =============================================================================== # Language Files Lines Code Comments Blanks # =============================================================================== # TypeScript 45 3420 2810 280 330 # Python 12 890 720 95 75 # JSON 8 340 340 0 0 # Markdown 5 210 0 180 30 # =============================================================================== # Total 70 4860 3870 555 435 # =============================================================================== ``` --- ## Intro Tokei is a blazing-fast code statistics tool written in Rust that counts lines of code, comments, and blanks across 200+ programming languages with 12,000+ GitHub stars. Run `tokei` in any directory and instantly get a breakdown of your codebase size by language. Output in table, JSON, YAML, or CBOR format for integration with CI dashboards and project reports. Best for developers who need quick codebase metrics for planning, reporting, or feeding context to AI agents. Works with: any codebase. Setup time: under 30 seconds. --- ## Features ### 200+ Languages Tokei recognizes TypeScript, Python, Rust, Go, Java, C++, Ruby, Swift, Kotlin, SQL, Markdown, YAML, and 190+ more. ### Output Formats ```bash tokei --output json # JSON for CI/dashboards tokei --output yaml # YAML tokei --output cbor # Binary format ``` ### Sorting & Filtering ```bash tokei --sort code # Sort by lines of code tokei --sort comments # Sort by comments tokei -e node_modules -e dist # Exclude directories tokei -t TypeScript,Python # Only specific languages ``` ### Per-File Breakdown ```bash tokei --files # Shows line counts per individual file ``` ### Git Integration ```bash # Count only files tracked by git tokei $(git ls-files) # Compare branches diff <(git stash && tokei --output json) <(git stash pop && tokei --output json) ``` ### Performance Written in Rust — counts millions of lines in seconds: ``` Linux kernel (28M lines): 1.2 seconds Chromium (35M lines): 1.8 seconds Small project (10K lines): 0.01 seconds ``` ### AI Context Use Case ```bash # Feed codebase stats to your AI agent tokei --output json | claude "Analyze this codebase breakdown and suggest where to focus refactoring" ``` ### Key Stats - 12,000+ GitHub stars - 200+ languages supported - Written in Rust (instant results) - JSON/YAML output for CI - Respects .gitignore ### FAQ **Q: What is Tokei?** A: Tokei is a Rust-powered tool that instantly counts lines of code, comments, and blanks across 200+ programming languages. **Q: Is Tokei free?** A: Yes, open-source under MIT/Apache 2.0 license. **Q: How does Tokei compare to cloc?** A: Tokei is 5-10x faster than cloc and handles modern languages better. Both produce similar output. --- ## Source & Thanks > Created by [XAMPPRocky](https://github.com/XAMPPRocky). Licensed under MIT/Apache 2.0. > > [tokei](https://github.com/XAMPPRocky/tokei) — ⭐ 12,000+ Thanks for making codebase statistics instant. --- ## 快速使用 ```bash brew install tokei # macOS tokei # 在项目目录运行,立即显示代码统计 ``` --- ## 简介 Tokei 是一个 Rust 编写的极速代码统计工具,GitHub 12,000+ stars。支持 200+ 语言,瞬间统计代码行、注释行和空白行。输出 JSON/YAML 可集成到 CI。适合需要快速了解代码库规模的开发者。 --- ## 来源与感谢 > Created by [XAMPPRocky](https://github.com/XAMPPRocky). Licensed under MIT/Apache 2.0. > > [tokei](https://github.com/XAMPPRocky/tokei) — ⭐ 12,000+ --- Source: https://tokrepo.com/en/workflows/e18416ca-e46b-4db6-b955-f485db46c8ed Author: Script Depot