A CLI code search tool that parses code structure and ranks results by relevance, with no index required.
XAMPPRocky/tokei
A fast command-line tool that counts files, lines, code, comments and blanks in your codebase, grouped by language.
Open-source alternative to:cloc
- Stars
- 15,010
- Forks
- 712
- Open issues
- 250
- Last commit
- 2 months ago
What is it?
Tokei is a command-line program that scans a directory and reports how much code it contains. For each language it shows the number of files, total lines, code lines, comment lines and blank lines, with a combined total at the bottom.
It respects .gitignore and .ignore files by default, supports excluding paths with patterns, and can sort output by any column or list statistics per file. Results can be exported as JSON, YAML or CBOR, and saved output can be fed back in to merge with another run. Tokei also ships as a Rust library for embedding the same counting logic in other programs.
The tool is available on Linux, macOS and Windows through common package managers such as Homebrew, Cargo, apt-style repositories, winget and Scoop, and it can be run in Docker.
Key features
- 01Counts files, code, comments and blank lines for each language.
- 02Respects .gitignore and .ignore files and supports custom exclusion patterns.
- 03Exports results as JSON, YAML or CBOR and can merge saved results.
- 04Lists per-file statistics and sorts output by any column.
- 05Available as a command-line tool and as a Rust library.
Use cases
- Getting a quick overview of the size and language mix of an unfamiliar codebase.
- Tracking code volume over time by storing and merging statistics from CI.
- Generating a code-size badge or report for a project README.
- Excluding generated or vendored files from line counts in large repositories.
Quick start
- 1
Install via Cargo (Rust package manager)
cargo install tokei - 2
Run tokei on the current folder
tokei .
Things to know
- Its license is listed as NOASSERTION in the metadata, though the README says it is dual MIT/Apache-2.0.
Topics
FAQ
- What is tokei?
- A fast command-line tool that counts files, lines, code, comments and blanks in your codebase, grouped by language. Tokei is a command-line program that scans a directory and reports how much code it contains. For each language it shows the number of files, total lines, code lines, comment lines and blank lines, with a combined total at the bottom.
- Is tokei free to use? What license does it have?
- tokei is open source under the Other license. Check the license terms before using it in commercial products.
- Is tokei still maintained?
- Updated within 6 months. The last commit to tokei was on Sep 6, 2026.
- What can I use tokei for?
- Getting a quick overview of the size and language mix of an unfamiliar codebase. Tracking code volume over time by storing and merging statistics from CI. Generating a code-size badge or report for a project README. Excluding generated or vendored files from line counts in large repositories.
- How do I install tokei?
- Install via Cargo (Rust package manager): cargo install tokei Run tokei on the current folder: tokei .
- Where can I get tokei?
- The source code and installation instructions are on GitHub: https://github.com/XAMPPRocky/tokei
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
CLI proxy that filters and compresses shell command output before it reaches an AI coding agent's context, cutting token use.
A fast, scriptable command-line tool for the App Store Connect API to automate iOS, macOS, tvOS and visionOS releases.
A minimal Rust-built statusline for Claude Code showing model, Git state, workspace, and context window usage in the terminal.
An open-source, AI-integrated terminal for macOS, Linux and Windows that supports BYOK and local models, durable SSH sessions and inline file previews.
Command-line tool that customizes the official Spotify desktop client with themes, injected CSS, extensions and custom apps.