Updated July 13, 2026

GitHub SLOC Counter Guide

OctoCounts is a free source lines of code counter for public repositories. It works from a URL, does not clone git history, and reports files, total lines, code, comments, blanks, and language totals.

What OctoCounts Is Best For

Supported Repository Hosts

HostSupportEntry point
GitHub public repositoriesWeb app, API, report pages, badges, Chrome extension, Firefox extensionhttps://github.com/owner/repo
Private repositoriesNot supportedRun tokei locally instead

How the Count Works

  1. OctoCounts validates the public repository URL and resolves the requested branch, tag, or commit SHA.
  2. The backend downloads a source archive for that exact ref instead of cloning full git history.
  3. The extracted source tree is counted with tokei.
  4. Generated and heavy dependency folders such as .git, node_modules, target, dist, and vendor are ignored by default.
  5. The report is cached by repository, commit SHA, tokei version, and analysis options.

For the full counting policy, cache key, exclusions, limitations, and citation format, see the OctoCounts methodology. Agent-readable context is also available in /llms.txt and /llms-full.txt.

Metrics Explained

MetricMeaning
FilesSource files detected by language rules.
Total linesCode lines + comment lines + blank lines.
Code linesExecutable or meaningful source lines after language parsing.
CommentsLine and block comments recognized by the language parser.
BlanksWhitespace-only lines.
LanguagesDetected programming languages and file types, sorted by code lines.

Examples

https://octocounts.com/?q=https://github.com/huanglizhuo/OctoCounts
https://octocounts.com/github/huanglizhuo/OctoCounts
https://octocounts.com/github/huanglizhuo/OctoCounts/tree/main
https://octocounts.com/compare?left=https://github.com/huanglizhuo/OctoCounts&right=https://github.com/tokio-rs/axum
https://octocounts.com/diff?repo=https://github.com/huanglizhuo/OctoCounts&base=main&head=22c3647

Badges

Use live badges to show repository size in a README:

[![OctoCounts](https://api.octocounts.com/badge/huanglizhuo/OctoCounts)](https://octocounts.com/github/huanglizhuo/OctoCounts)
[![Code lines](https://api.octocounts.com/badge/huanglizhuo/OctoCounts?type=code)](https://octocounts.com/github/huanglizhuo/OctoCounts)
[![Rust lines](https://api.octocounts.com/badge/huanglizhuo/OctoCounts?lang=Rust)](https://octocounts.com/github/huanglizhuo/OctoCounts)

API

Programmatic users can start an analysis with POST /api/analyze, poll GET /api/jobs/:jobId, and fetch the result with GET /api/reports/:reportId. See the OctoCounts API docs for request bodies, report fields, and badge routes.

Privacy and Scope

OctoCounts analyzes public repositories only. It does not request GitHub account access, does not support private repositories, and does not accept source-code uploads. Cached reports contain public repository statistics only.