OctoCounts – GitHub SLOC Counter

OctoCounts is a free SLOC counter for public GitHub repositories. It counts files, code lines, comments, blanks, and per-language totals without cloning: the backend downloads the repository source archive, runs tokei, and caches the result by commit SHA. Neither the web app nor the Chrome, Edge, and Firefox browser extensions require an account.

OctoCounts mascot next to a terminal card reading Total LOC 5,505 with Code, Comments, and Blanks counts, and the tagline: Making your code count (literally).

Last updated: 2026-09-08 · Maintained by huanglizhuo

How it works

  1. OctoCounts resolves the requested branch, tag, or commit and pins the analysis to an exact commit SHA.
  2. It downloads the repository's source archive tarball — never a full git clone with history.
  3. tokei, the open-source line counter written in Rust, counts every source file into files, total lines, code, comments, and blanks per language.
  4. The report is cached by commit SHA, tokei version, and analysis options, so counting the same revision again is instant and reproduces exactly the same numbers.

Frequently Asked Questions

What is SLOC?

SLOC stands for Source Lines of Code. It is a software metric used to measure the size of a program by counting the lines in its source code. Unlike raw line count, SLOC distinguishes between code lines (actual instructions the compiler or interpreter processes), comment lines (documentation and explanations), and blank lines (whitespace). This breakdown matters because a 10,000-line file that is 40% comments tells a different story than one that is 95% code.

Developers use SLOC to estimate project complexity, compare codebases when evaluating dependencies, scope billing and audit work, and communicate repository size to stakeholders who may not read code. OctoCounts reports SLOC at two levels: per programming language and as aggregate totals across the entire repository. The underlying counter is tokei, an open-source line counter written in Rust that processes files in parallel.

Why use OctoCounts instead of cloning and running tokei locally?

OctoCounts downloads a compressed archive tarball rather than a full git clone with history. A git clone transfers every commit object, tree object, and blob in the repository's history; for a long-lived project that can mean hundreds of megabytes or gigabytes of data even if the current source tree is small. OctoCounts fetches only the archive of the working tree at the requested ref, so the transfer covers the current source tree instead of the repository's entire history.

Additionally, there is nothing to install. No git, no Rust toolchain, no tokei binary. Just paste a GitHub URL into the web app or install the browser extension once. Results are cached by commit SHA and tokei version, so any repeated analysis of the same commit returns instantly with zero re-download and zero re-processing. This makes OctoCounts especially useful for quickly evaluating dependencies or unfamiliar repositories without setting up a local environment.

Does OctoCounts have a browser extension?

Yes. OctoCounts has browser extensions for Chrome, Edge, and Firefox, all named OctoCounts – GitHub SLOC & Code Statistics. Install from the Chrome Web Store, Microsoft Edge Add-ons, or Firefox Add-ons to add a compact SLOC card directly to GitHub repository sidebars. The card appears automatically on any public repository page and shows the total line count and analysis status. Clicking the card opens the full panel, which displays files, total lines, code lines, comment lines, and blank lines per language, the same breakdown as the web app.

The extension includes a local cache so results load instantly on repeat visits to the same repository and ref. You can configure the auto-analyze setting to fetch counts immediately on page load, or trigger analysis manually. The placement setting controls where the card appears in the GitHub sidebar. No GitHub account or API token is required. The extension source code is publicly available on GitHub.

Is OctoCounts free to use?

Yes. OctoCounts is completely free to use for public GitHub repositories. There is no account required, no API key, no sign-up, and no rate limit that is publicly documented. Both the web app and the browser extensions are free with no premium tier. The backend is open source, written in Rust using the Axum framework, and the frontend is written in React with TypeScript. If you prefer, you can self-host the entire stack; the source code is available on GitHub at github.com/huanglizhuo/OctoCounts.

OctoCounts intentionally analyzes public repositories only. It does not request GitHub account access, does not support private repositories, and does not accept source-code uploads. OctoCounts has no advertising and collects no personal data.

What programming languages does OctoCounts support?

OctoCounts uses tokei for language detection, which supports over 200 programming languages and file types. Languages covered include Rust, Python, JavaScript, TypeScript, Go, Java, C, C++, C#, Ruby, Swift, Kotlin, PHP, Scala, Haskell, Elixir, Erlang, Clojure, F#, Lua, R, Julia, Dart, Perl, Shell, Bash, PowerShell, HTML, CSS, SCSS, SQL, GraphQL, Dockerfile, YAML, JSON, TOML, XML, Markdown, and many more.

tokei detects languages primarily by file extension, with fallback to shebang lines and content-based detection for ambiguous files. It handles multi-language files and supports configuration to exclude specific directories such as node_modules, vendor, or build output folders. OctoCounts automatically skips heavy generated folders before passing the archive to tokei, which means the SLOC count reflects actual human-written source code rather than auto-generated files that would inflate the numbers.

Can I export the source line count results?

Yes. OctoCounts supports three export formats available from the action buttons below the analysis results. Plain text copies a formatted table to your clipboard, showing language name, file count, total lines, code lines, comment lines, and blank lines in a column-aligned layout suitable for pasting into README files, GitHub issues, or documentation. JSON downloads the full structured report including per-language stats and aggregate totals, formatted for use in scripts, CI pipelines, or other tools that consume JSON.

PNG downloads a 1200 × 630 image card showing the language breakdown, suitable for sharing on Twitter, LinkedIn, GitHub repository READMEs, or portfolio pages. The PNG card uses the same dark and light color palette as the web app and includes the repository name, total line count, and a language breakdown. All three formats are generated client-side from the analysis data already loaded in your browser, so no additional server request is needed.

Does OctoCounts support private repositories?

OctoCounts supports public GitHub repositories only. It does not request GitHub account access, does not support private repositories, and does not accept source-code uploads. If you need to count lines of code in a private repository, run tokei locally. Download tokei from github.com/XAMPPRocky/tokei, clone your repository, and run tokei in the repository root. tokei is free, open source, and produces the same output format that OctoCounts uses.

Explore OctoCounts

Example reports: facebook/react, vitejs/vite, torvalds/linux.