Purpose
OctoCounts is used to count the source lines of code (SLOC, Source Lines of Code) of public GitHub repositories, helping developers, teams, or related parties quickly understand the scale of a codebase, its language composition, and an overview of code quality, without cloning the repository locally.
Main capabilities
- Counts files, total lines, lines of code, comment lines, and blank lines, and summarizes them by programming language.
- Supports more than 200 programming languages and file types. Language detection is mainly based on file extensions, and for ambiguous files it can fall back to shebang lines and content detection.
- Can automatically skip generated directories such as node_modules, vendor, .git, and build output, making the statistics closer to human-written source code.
- Generates public reports. Reports are stored by owner, repository, commit SHA, and tokei version, and analyzing the same commit again can directly hit the cache without re-downloading and counting.
- Provides live README badges that can link to permanent reports.
- Supports side-by-side comparison of two repositories (totals, language composition, differences), as well as growth comparison between two refs of the same repository (such as different release versions or branches).
- Provides API, task, report, badge, SEO, and statistics endpoints.
- Can run a command-line tool or CI script, outputting text or JSON.
- Can comment SLOC changes in pull requests, integrating into code review workflows.
- Can provide SLOC reports for agent workflows and developer assistants.
- Supports export as plain text tables, JSON structured data, and 1200×630 PNG image cards.
How to use
- Web: paste a public GitHub repository URL to analyze it. OctoCounts validates the URL and resolves the requested branch, tag, or commit SHA through the GitHub API to a fixed commit hash, ensuring that the same URL and ref always get the same count, and the cache key remains stable. The backend is written in Rust, downloads compressed archives instead of full git clones, and then tokei counts each source file in a background work queue.
- Browser extensions: Chrome, Edge, and Firefox all have extensions, all named “OctoCounts – GitHub SLOC & Code Statistics”. After installation, open a public GitHub repository page, and the sidebar willAutomatically adds a concise SLOC card showing the total line count and analysis status; clicking the card opens the full panel to view files, total lines, lines of code, comment lines, blank lines, and a breakdown by language. The extension includes local caching, so repeated visits to the same repository and ref load instantly. Users can configure automatic analysis (fetch counts immediately after page load) or trigger it manually, and can also set the card's position in the GitHub sidebar. No GitHub account or API token is required.
- Terminal or CI: can be run via command line or CI scripts, with text or JSON output.
- Pull requests: can comment on SLOC changes in the review workflow.
- Agent workflows: can provide SLOC reports for developer assistants.
Use cases
- Evaluating dependencies: before adopting a new open-source library, see its actual size, not just the file count. A repository with 50 files could be 20,000 lines of dense C++ or 500 lines of glue code.
- Estimating project size: when a client or stakeholder asks how large a codebase is, SLOC can provide a reliable number, for example "12,000 lines across 8 languages, 89% code, 4% comments".
- Comparing forks or different implementations: paste two repositories to compare language composition side by side, to understand how far a fork has diverged or how different implementations of the same specification differ.
Limitations
- Only public GitHub repositories are supported; private repositories are not supported.
- No GitHub account access is required, and no source code uploads are accepted.
- No ads, and no personal data is collected.
- If you need to count lines of code in private repositories, the official recommendation is to run tokei locally. You can download tokei from github.com/XAMPPRocky/tokei, clone the repository, and run it in the root directory; its output format is the same as OctoCounts.
- The browser extension source code is publicly available on GitHub.
Pricing
OctoCounts is completely free for public GitHub repositories, with no account, API key, or registration required, and the public documentation does not mention rate limits. Both the web app and the browser extension are free, with no premium paid tier. If you wish, you can self-host the entire stack, with the source code at github.com/huanglizhuo/OctoCounts.