explaingit

xampprocky/tokei

14,419RustAudience · developerComplexity · 2/5Setup · easy

TLDR

Tokei is a fast command-line tool that counts lines of code, comments, and blank lines across 150+ languages in seconds, with output as a table, JSON, YAML, or CBOR for use in scripts and CI pipelines.

Mindmap

mindmap
  root((tokei))
    What It Does
      Counts lines of code
      150 plus languages
      Fast Rust speed
    Output Formats
      Table default
      JSON YAML
      CBOR binary
    Features
      Merge past results
      Per-file stats
      Gitignore exclusions
    Install Options
      Homebrew Mac
      Cargo Rust
      Scoop Windows
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Get a breakdown of code vs. comment vs. blank lines for every language in a project folder

USE CASE 2

Export code statistics as JSON and feed them into a dashboard or CI report

USE CASE 3

Combine multiple historical scan results into one aggregated report to track code growth

USE CASE 4

Exclude test or vendor folders from the count using .gitignore-style patterns

Tech stack

Rust

Getting it running

Difficulty · easy Time to first run · 5min

In plain English

Tokei (pronounced like the Japanese word for "clock") is a command-line tool that counts the lines of code in a project. You point it at a folder, and it produces a table showing how many files exist per programming language, along with totals for lines of actual code, comment lines, and blank lines. It is written in Rust, a compiled systems programming language known for speed. The tool is designed to be fast. According to the README, it can process millions of lines of code in seconds. It supports over 150 programming languages and their various file extensions. It also handles edge cases carefully, such as comments written inside strings (which should not be counted as real comments) and nested comment blocks. Tokei can produce output in several formats beyond the default human-readable table. You can ask it to output JSON, YAML, or CBOR (a binary format), which makes it easy to feed the results into another program or store them for later comparison. You can also pass a previously saved result file back into Tokei and it will combine those old statistics with a new scan. Common usage patterns include scanning a single folder, scanning multiple folders at once, excluding certain files or folders (using the same syntax as a .gitignore file), sorting results by code count or comment count, and listing per-file statistics instead of just per-language totals. A configuration file named tokei.toml or .tokeirc can set default behaviors. Tokei is available on Mac, Linux, and Windows. It can be installed through many package managers, including Homebrew on Mac, Cargo (the Rust package manager), Scoop on Windows, Conda, and several Linux distribution package managers. It can also be used as a software library so other programs can call into its counting functionality.

Copy-paste prompts

Prompt 1
Run tokei on my project and output the results as JSON. Write a Python script that reads that JSON and generates a bar chart of lines of code by language using matplotlib.
Prompt 2
Write a GitHub Actions workflow step that runs tokei and fails the build if the total blank-line ratio exceeds 30%.
Prompt 3
Show me the tokei commands to save a baseline JSON before a refactor and then compare it against a new scan after the refactor.
Prompt 4
How do I configure a tokei.toml file to always exclude the vendor/ and node_modules/ directories and sort output by code count?
Open on GitHub → Explain another repo

← xampprocky on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.