Updated June 11, 2026

GitHub and GitLab 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, badges, Chrome extension, Firefox extensionhttps://github.com/owner/repo
GitLab public repositoriesWeb app and APIhttps://gitlab.com/group/project
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.

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/OctoCount
https://octocounts.com/github/huanglizhuo/OctoCount
https://octocounts.com/github/huanglizhuo/OctoCount/tree/main
https://octocounts.com/compare?left=https://github.com/huanglizhuo/OctoCount&right=https://github.com/tokio-rs/axum
https://octocounts.com/diff?repo=https://github.com/huanglizhuo/OctoCount&base=main&head=22c3647

Badges

Use live badges to show repository size in a README:

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

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 or GitLab account access, does not support private repositories, and does not accept source-code uploads. Cached reports contain public repository statistics only.