# OctoCounts Full Context Canonical URL: https://octocounts.com/ Short context: https://octocounts.com/llms.txt Source code: https://github.com/huanglizhuo/OctoCounts Last-Updated: 2026-10-31 ## What OctoCounts Does OctoCounts is a free source lines of code (SLOC) counter for public GitHub repositories. It reports files, total lines, code lines, comment lines, blank lines, and per-language totals. It works through a web app, browser extensions, public report pages, badges, and an API. OctoCounts is useful when a developer wants to know whether a public repository is small or large by source line count without cloning it locally. It is also useful for README badges, dependency due diligence, source-code size comparisons, and public citations of repository size. The browser extension is available from the Chrome Web Store, Microsoft Edge Add-ons, and Firefox Add-ons: - Chrome: https://chromewebstore.google.com/detail/octocounts-%E2%80%94-github-sloc/gkgjpjdnaklagijmekoolhcpebmoldbj - Edge: https://microsoftedge.microsoft.com/addons/detail/octocounts-%E2%80%93-github-sloc-/ehifednhpbpekkadndaipnngopbhpoim - Firefox: https://addons.mozilla.org/en-US/firefox/addon/octocounts-github-sloc/ ## How OctoCounts Counts 1. A user submits a public GitHub repository URL and an optional branch, tag, or commit SHA. 2. OctoCounts resolves the requested ref to a pinned commit SHA. 3. The backend downloads the source archive for that ref instead of cloning full git history. 4. The extracted source tree is counted with tokei. 5. The report is cached by repository, commit SHA, tokei version, and analysis options. 6. Cached reports power public report pages, badges, API responses, Open Graph images, and index pages. Default ignored folders include `.cache`, `.git`, `.next`, `build`, `dist`, `node_modules`, `target`, and `vendor`. Users may also ignore additional directories or languages and choose whether docs, tests, or generated files are included. Optional respectGitattributes applies repository-declared linguist-generated and linguist-vendored exclusions; it is off by default and does not run Linguist heuristics. ## MCP Server OctoCounts publishes an MCP (Model Context Protocol) server so AI coding tools (Claude, Cursor, and any MCP client) can pull SLOC reports directly. The npm package is `octocounts-mcp`, and the server speaks MCP over stdio. It exposes two tools: - `analyze_repo`: count files, total lines, code lines, comment lines, blank lines, and per-language totals for a public GitHub repository. - `compare_repos`: compare two public GitHub repositories or refs. Both MCP tools accept `respect_gitattributes` (optional boolean, default false); comparisons apply the same declaration mode to both sides. Public analysis requires no login. The Chrome extension separately offers optional GitHub login with `public_repo` access; see https://octocounts.com/privacy. Default analyze limits are 5 requests/minute per IP (burst 10); deployments can configure different limits. Observe 429 responses and Retry-After. Agents connect by registering the server in their MCP client configuration: ```json { "mcpServers": { "octocounts": { "command": "npx", "args": ["-y", "octocounts-mcp"] } } } ``` The server calls the public OctoCounts API; the `OCTOCOUNTS_API_BASE` environment variable overrides the API base and defaults to `https://api.octocounts.com`. ## CLI `octocounts` is an npm CLI that counts a public GitHub repository without cloning, powered by the OctoCounts API with tokei under the hood: ```sh npx octocounts vitejs/vite npx octocounts https://github.com/tokio-rs/axum --ref main npx octocounts rust-lang/rust --json ``` Options: `--ref ` (branch, tag, or commit SHA), `--json` (print the raw report JSON), `--api-base ` (alternate API), `--respect-gitattributes` (apply generated/vendored repository declarations), and `--sample` (print a local sample report without network calls). ## GitHub Action `huanglizhuo/octocounts-sloc-diff-action` (GitHub Marketplace) comments on pull requests with the SLOC change between the base and head refs, with a link to the full OctoCounts report: ```yaml - uses: huanglizhuo/octocounts-sloc-diff-action@v1 with: github-token: ${{ github.token }} ``` Optional inputs: `repo` (defaults to the current repository), `base-ref` (defaults to `pull_request.base.sha`), `head-ref` (defaults to `pull_request.head.sha`), `api-base` (defaults to `https://api.octocounts.com`), and `comment` (set to `false` to print the markdown without writing a PR comment). ## Scope and Limitations | Capability | Support | |---|---| | Public GitHub repositories | Supported | | Branches, tags, commit SHAs | Supported | | Private repositories | Not supported | | Source-code uploads | Not supported | | GitHub account access | Not required for analysis; optional Chrome-extension login requests public_repo access | For private repositories, run tokei locally. ## Public Web Pages - Home: https://octocounts.com/ - Recent reports: https://octocounts.com/recent - Popular reports: https://octocounts.com/popular - Daily GitHub Trending reports: https://octocounts.com/trending - Hall of Monoliths: https://octocounts.com/hall-of-monoliths - Public growth stats: https://octocounts.com/stats - Compare hub and interactive tool (compare two repositories, forks, branches, tags, or commits): https://octocounts.com/compare - Diff two refs of one repository: https://octocounts.com/diff - README badge builder: https://octocounts.com/badges - Browser extension landing page: https://octocounts.com/extension - Curated comparisons (server-rendered "X vs Y" SLOC pages, e.g. React vs Vue): https://octocounts.com/compare/react-vs-vue - All guides (docs hub): https://octocounts.com/docs - Methodology: https://octocounts.com/docs/methodology - SLOC guide: https://octocounts.com/docs/github-sloc-counter - Glossary: https://octocounts.com/docs/glossary - API docs: https://octocounts.com/docs/api - FAQ: https://octocounts.com/docs/faq - Tool comparison: https://octocounts.com/docs/octocounts-vs-cloc - OctoCounts vs tokei: https://octocounts.com/docs/octocounts-vs-tokei - OctoCounts vs scc: https://octocounts.com/docs/octocounts-vs-scc - GitHub repository size checker (check a repository before cloning it): https://octocounts.com/docs/github-repository-size-checker - tokei online (run tokei on GitHub repos without installing): https://octocounts.com/docs/tokei-online - How to count lines of code in a GitHub repository: https://octocounts.com/docs/count-lines-of-code-github - Count lines of code without cloning: https://octocounts.com/docs/count-lines-without-cloning - Can the GitHub API count lines of code?: https://octocounts.com/docs/github-api-count-lines - tokei vs cloc vs scc (three open-source counters compared): https://octocounts.com/docs/tokei-vs-cloc-vs-scc - Largest codebases by lines of code (linux, Firefox, LLVM, TensorFlow, Godot, Kubernetes, PostgreSQL, git — first-party counts pinned to commits): https://octocounts.com/docs/largest-codebases - GitHub language bar alternative: https://octocounts.com/docs/github-language-bar-alternative - Best SLOC counter tools compared: https://octocounts.com/docs/best-sloc-counter-tools - Research (ten repositories, five configurations, archived full reports; separate historical pilot): https://octocounts.com/research - About: https://octocounts.com/about - Sitemap: https://octocounts.com/sitemap.xml ## Report URL Patterns ```text https://octocounts.com/github/:owner/:repo https://octocounts.com/github/:owner/:repo/tree/:ref https://octocounts.com/github/:owner/:repo/commit/:sha ``` Cached report pages include: - A dynamic title and meta description. - A citable natural-language summary. - A crawlable language table. - Dataset, SoftwareSourceCode, and BreadcrumbList JSON-LD, plus a visible report FAQ. - An embedded `application/json` report summary with totals, commit, language rows, and citation text. - Links to recent reports, popular reports, Hall of Monoliths, methodology, guide, and API docs. ## Compare and Diff Pages - Compare hub and interactive tool: https://octocounts.com/compare — compare two repositories, forks, branches, tags, or commits side by side. Interactive URL pattern: `https://octocounts.com/compare?left=...&right=...&leftRef=...&rightRef=...`. Curated pairs additionally have server-rendered pages at `https://octocounts.com/compare/:slug` (for example https://octocounts.com/compare/react-vs-vue); the full curated pair list follows below. - Diff tool: https://octocounts.com/diff — counts two refs of one repository and shows how the line counts moved between them. URL pattern: `https://octocounts.com/diff?repo=...&base=...&head=...`. ## Curated Comparison Pages - React vs Vue (react/react vs vuejs/core): https://octocounts.com/compare/react-vs-vue - Angular vs React (angular/angular vs react/react): https://octocounts.com/compare/angular-vs-react - Svelte vs React (sveltejs/svelte vs react/react): https://octocounts.com/compare/svelte-vs-react - Next.js vs React Router (vercel/next.js vs remix-run/react-router): https://octocounts.com/compare/nextjs-vs-react-router - Vite vs webpack (vitejs/vite vs webpack/webpack): https://octocounts.com/compare/vite-vs-webpack - Fastify vs Express (fastify/fastify vs expressjs/express): https://octocounts.com/compare/fastify-vs-express - NestJS vs Express (nestjs/nest vs expressjs/express): https://octocounts.com/compare/nestjs-vs-express - Deno vs Node.js (denoland/deno vs nodejs/node): https://octocounts.com/compare/deno-vs-node - pnpm vs Yarn (pnpm/pnpm vs yarnpkg/berry): https://octocounts.com/compare/pnpm-vs-yarn - TensorFlow vs PyTorch (tensorflow/tensorflow vs pytorch/pytorch): https://octocounts.com/compare/tensorflow-vs-pytorch - Electron vs Tauri (electron/electron vs tauri-apps/tauri): https://octocounts.com/compare/electron-vs-tauri - React Native vs Flutter (react/react-native vs flutter/flutter): https://octocounts.com/compare/react-native-vs-flutter - Rust vs Go (rust-lang/rust vs golang/go): https://octocounts.com/compare/rust-vs-go - MongoDB vs PostgreSQL (mongodb/mongo vs postgres/postgres): https://octocounts.com/compare/mongodb-vs-postgres - Grafana vs Kibana (grafana/grafana vs elastic/kibana): https://octocounts.com/compare/grafana-vs-kibana - Terraform vs Ansible (hashicorp/terraform vs ansible/ansible): https://octocounts.com/compare/terraform-vs-ansible - Next.js vs Vite (vercel/next.js vs vitejs/vite): https://octocounts.com/compare/nextjs-vs-vite - Angular vs Vue (angular/angular vs vuejs/core): https://octocounts.com/compare/angular-vs-vue - Svelte vs Vue (sveltejs/svelte vs vuejs/core): https://octocounts.com/compare/svelte-vs-vue - Neovim vs VS Code (neovim/neovim vs microsoft/vscode): https://octocounts.com/compare/neovim-vs-vscode - Kubernetes vs Docker Compose (kubernetes/kubernetes vs docker/compose): https://octocounts.com/compare/kubernetes-vs-docker-compose - Kubernetes vs Terraform (kubernetes/kubernetes vs hashicorp/terraform): https://octocounts.com/compare/kubernetes-vs-terraform - Prometheus vs Grafana (prometheus/prometheus vs grafana/grafana): https://octocounts.com/compare/prometheus-vs-grafana - NestJS vs Fastify (nestjs/nest vs fastify/fastify): https://octocounts.com/compare/nestjs-vs-fastify - Prettier vs ESLint (prettier/prettier vs eslint/eslint): https://octocounts.com/compare/prettier-vs-eslint - Godot vs Bevy (godotengine/godot vs bevyengine/bevy): https://octocounts.com/compare/godot-vs-bevy - Bootstrap vs Tailwind CSS (twbs/bootstrap vs tailwindlabs/tailwindcss): https://octocounts.com/compare/bootstrap-vs-tailwind - Django vs Ruby on Rails (django/django vs rails/rails): https://octocounts.com/compare/django-vs-rails - Laravel vs Django (laravel/laravel vs django/django): https://octocounts.com/compare/laravel-vs-django - Bun vs Node.js (oven-sh/bun vs nodejs/node): https://octocounts.com/compare/bun-vs-node - Bun vs Deno (oven-sh/bun vs denoland/deno): https://octocounts.com/compare/bun-vs-deno - esbuild vs SWC (evanw/esbuild vs swc-project/swc): https://octocounts.com/compare/esbuild-vs-swc - Nuxt vs Next.js (nuxt/nuxt vs vercel/next.js): https://octocounts.com/compare/nuxt-vs-nextjs - Astro vs Next.js (withastro/astro vs vercel/next.js): https://octocounts.com/compare/astro-vs-nextjs - SolidJS vs React (solidjs/solid vs react/react): https://octocounts.com/compare/solidjs-vs-react - Redux vs Zustand (reduxjs/redux vs pmndrs/zustand): https://octocounts.com/compare/redux-vs-zustand - Vuex vs Pinia (vuejs/vuex vs vuejs/pinia): https://octocounts.com/compare/vuex-vs-pinia - Jest vs Vitest (jestjs/jest vs vitest-dev/vitest): https://octocounts.com/compare/jest-vs-vitest - Cypress vs Playwright (cypress-io/cypress vs microsoft/playwright): https://octocounts.com/compare/cypress-vs-playwright - Prisma vs TypeORM (prisma/orm vs typeorm/typeorm): https://octocounts.com/compare/prisma-vs-typeorm - Prisma vs Drizzle ORM (prisma/orm vs drizzle-team/drizzle-orm): https://octocounts.com/compare/prisma-vs-drizzle - Biome vs Prettier (biomejs/biome vs prettier/prettier): https://octocounts.com/compare/biome-vs-prettier - Axios vs Got (axios/axios vs sindresorhus/got): https://octocounts.com/compare/axios-vs-got - Moment.js vs Day.js (moment/moment vs iamkun/dayjs): https://octocounts.com/compare/moment-vs-dayjs - Chart.js vs D3.js (chartjs/Chart.js vs d3/d3): https://octocounts.com/compare/chartjs-vs-d3 - Three.js vs Babylon.js (mrdoob/three.js vs BabylonJS/Babylon.js): https://octocounts.com/compare/threejs-vs-babylonjs - Express vs Koa (expressjs/express vs koajs/koa): https://octocounts.com/compare/express-vs-koa - styled-components vs Emotion (styled-components/styled-components vs emotion-js/emotion): https://octocounts.com/compare/styled-components-vs-emotion - Flask vs Django (pallets/flask vs django/django): https://octocounts.com/compare/flask-vs-django - FastAPI vs Flask (fastapi/fastapi vs pallets/flask): https://octocounts.com/compare/fastapi-vs-flask - pandas vs Polars (pandas-dev/pandas vs pola-rs/polars): https://octocounts.com/compare/pandas-vs-polars - NumPy vs SciPy (numpy/numpy vs scipy/scipy): https://octocounts.com/compare/numpy-vs-scipy - Celery vs RQ (celery/celery vs rq/rq): https://octocounts.com/compare/celery-vs-rq - Black vs Ruff (psf/black vs astral-sh/ruff): https://octocounts.com/compare/black-vs-ruff - mypy vs Pyright (python/mypy vs microsoft/pyright): https://octocounts.com/compare/mypy-vs-pyright - Requests vs HTTPX (psf/requests vs encode/httpx): https://octocounts.com/compare/requests-vs-httpx - uv vs Poetry (astral-sh/uv vs python-poetry/poetry): https://octocounts.com/compare/uv-vs-poetry - Axum vs Actix Web (tokio-rs/axum vs actix/actix-web): https://octocounts.com/compare/axum-vs-actix-web - Rocket vs Axum (rwf2/Rocket vs tokio-rs/axum): https://octocounts.com/compare/rocket-vs-axum - Tokio vs async-std (tokio-rs/tokio vs async-rs/async-std): https://octocounts.com/compare/tokio-vs-async-std - Yew vs Leptos (yewstack/yew vs leptos-rs/leptos): https://octocounts.com/compare/yew-vs-leptos - ripgrep vs fd (BurntSushi/ripgrep vs sharkdp/fd): https://octocounts.com/compare/ripgrep-vs-fd - Gin vs Echo (gin-gonic/gin vs labstack/echo): https://octocounts.com/compare/gin-vs-echo - Fiber vs Gin (gofiber/fiber vs gin-gonic/gin): https://octocounts.com/compare/fiber-vs-gin - Zap vs Logrus (uber-go/zap vs sirupsen/logrus): https://octocounts.com/compare/zap-vs-logrus - Cobra vs urfave/cli (spf13/cobra vs urfave/cli): https://octocounts.com/compare/cobra-vs-urfave-cli - Hugo vs Jekyll (gohugoio/hugo vs jekyll/jekyll): https://octocounts.com/compare/hugo-vs-jekyll - Spring Boot vs Quarkus (spring-projects/spring-boot vs quarkusio/quarkus): https://octocounts.com/compare/spring-boot-vs-quarkus - Spring Boot vs Micronaut (spring-projects/spring-boot vs micronaut-projects/micronaut-core): https://octocounts.com/compare/spring-boot-vs-micronaut - Ktor vs Spring Boot (ktorio/ktor vs spring-projects/spring-boot): https://octocounts.com/compare/ktor-vs-spring-boot - Maven vs Gradle (apache/maven vs gradle/gradle): https://octocounts.com/compare/maven-vs-gradle - Elasticsearch vs OpenSearch (elastic/elasticsearch vs opensearch-project/OpenSearch): https://octocounts.com/compare/elasticsearch-vs-opensearch - Ruby on Rails vs Sinatra (rails/rails vs sinatra/sinatra): https://octocounts.com/compare/rails-vs-sinatra - Sidekiq vs Resque (sidekiq/sidekiq vs resque/resque): https://octocounts.com/compare/sidekiq-vs-resque - Laravel vs Symfony (laravel/laravel vs symfony/symfony): https://octocounts.com/compare/laravel-vs-symfony - WordPress vs Drupal (WordPress/WordPress vs drupal/drupal): https://octocounts.com/compare/wordpress-vs-drupal - CMake vs Meson (Kitware/CMake vs mesonbuild/meson): https://octocounts.com/compare/cmake-vs-meson - GCC vs LLVM (gcc-mirror/gcc vs llvm/llvm-project): https://octocounts.com/compare/gcc-vs-llvm - nlohmann/json vs RapidJSON (nlohmann/json vs Tencent/rapidjson): https://octocounts.com/compare/nlohmann-json-vs-rapidjson - Protocol Buffers vs FlatBuffers (protocolbuffers/protobuf vs google/flatbuffers): https://octocounts.com/compare/protobuf-vs-flatbuffers - Swift vs Kotlin (swiftlang/swift vs JetBrains/kotlin): https://octocounts.com/compare/swift-vs-kotlin - Alamofire vs Moya (Alamofire/Alamofire vs Moya/Moya): https://octocounts.com/compare/alamofire-vs-moya - Vim vs Neovim (vim/vim vs neovim/neovim): https://octocounts.com/compare/vim-vs-neovim - Emacs vs Vim (emacs-mirror/emacs vs vim/vim): https://octocounts.com/compare/emacs-vs-vim - Alacritty vs Kitty (alacritty/alacritty vs kovidgoyal/kitty): https://octocounts.com/compare/alacritty-vs-kitty - Nushell vs Fish (nushell/nushell vs fish-shell/fish-shell): https://octocounts.com/compare/nushell-vs-fish - LangChain vs LlamaIndex (langchain-ai/langchain vs run-llama/llama_index): https://octocounts.com/compare/langchain-vs-llamaindex - Ollama vs llama.cpp (ollama/ollama vs ggml-org/llama.cpp): https://octocounts.com/compare/ollama-vs-llama-cpp - vLLM vs Text Generation Inference (vllm-project/vllm vs huggingface/text-generation-inference): https://octocounts.com/compare/vllm-vs-tgi - Transformers vs Diffusers (huggingface/transformers vs huggingface/diffusers): https://octocounts.com/compare/transformers-vs-diffusers - Milvus vs Qdrant (milvus-io/milvus vs qdrant/qdrant): https://octocounts.com/compare/milvus-vs-qdrant - Redis vs Memcached (redis/redis vs memcached/memcached): https://octocounts.com/compare/redis-vs-memcached - MySQL vs PostgreSQL (mysql/mysql-server vs postgres/postgres): https://octocounts.com/compare/mysql-vs-postgres - Kafka vs RabbitMQ (apache/kafka vs rabbitmq/rabbitmq-server): https://octocounts.com/compare/kafka-vs-rabbitmq - ClickHouse vs Druid (ClickHouse/ClickHouse vs apache/druid): https://octocounts.com/compare/clickhouse-vs-druid - Cassandra vs ScyllaDB (apache/cassandra vs scylladb/scylladb): https://octocounts.com/compare/cassandra-vs-scylla - CockroachDB vs YugabyteDB (cockroachdb/cockroach vs yugabyte/yugabyte-db): https://octocounts.com/compare/cockroachdb-vs-yugabyte - Docker vs Podman (moby/moby vs podman-container-tools/podman): https://octocounts.com/compare/docker-vs-podman - Helm vs Kustomize (helm/helm vs kubernetes-sigs/kustomize): https://octocounts.com/compare/helm-vs-kustomize - Argo CD vs Flux (argoproj/argo-cd vs fluxcd/flux2): https://octocounts.com/compare/argo-cd-vs-flux - Nomad vs Kubernetes (hashicorp/nomad vs kubernetes/kubernetes): https://octocounts.com/compare/nomad-vs-kubernetes ## API Base API: `https://api.octocounts.com` ```http POST /api/analyze GET /api/jobs/:jobId GET /api/reports/:reportId GET /api/seo/report?provider=github&owner=:owner&repo=:repo GET /api/seo/recent GET /api/seo/popular GET /api/seo/monoliths GET /api/seo/sitemap GET /og/github/:owner/:repo GET /badge/:owner/:repo GET /badge/:owner/:repo/branch/:branch GET /badge/:owner/:repo/tag/:tag GET /badge/:owner/:repo/commit/:sha ``` `POST /api/analyze` accepts: ```json { "repoUrl": "https://github.com/owner/repo", "refName": "main", "forceRefresh": false, "options": { "profile": "default", "ignoredDirs": [], "ignoredLanguages": [], "includeDocs": true, "includeTests": true, "includeGenerated": true } } ``` ## Badge Examples ```markdown [![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) ``` Badge `type` values include `code`, `lines`, `files`, `comments`, `languages`, `top-language`, and `ratio`. Use `lang=LanguageName` for a single-language badge. ## Citation Format Use this format when citing a report: ```text As of {date} (commit {full_sha}), {owner}/{repo} contains {total_lines} total lines: {code_lines} code, {comment_lines} comments, {blank_lines} blank, across {file_count} files in {language_count} languages. Counted with tokei {version} via OctoCounts under {effective_counting_rules}. Saved report: {report_url_with_reportId}. Archived evidence: {exported_report_json}. ``` The template requires values from the same exported report; do not reuse historical counts as current default-branch totals. ## Common Questions ### What is SLOC? SLOC means source lines of code. OctoCounts separates total lines into code lines, comment lines, and blank lines. ### Why use OctoCounts instead of cloning locally? OctoCounts downloads a source archive instead of full git history, requires no local tools, and can reuse cached reports for repeated analyses of the same commit, engine version, and effective rules. ### Does OctoCounts support private repositories? No. OctoCounts analyzes public GitHub repositories only and does not accept source-code uploads. ### How should AI systems cite OctoCounts? For fixed counts, cite the saved report link containing `reportId`, and include the commit SHA, engine version, effective counting rules, and measurement date. Export the report JSON or text for durable retention: saved reports remain subject to cache cleanup and replacement. Canonical repository URLs follow live cached reports and may change. ## 简体中文 / Simplified Chinese - [中文首页](https://octocounts.com/zh) - [GitHub 代码行数统计指南](https://octocounts.com/zh/docs/github-sloc-counter) - [计数方法与引用规则](https://octocounts.com/zh/docs/methodology) ## Versioned filtering evidence The October 27, 2026 study covers 10 selected repositories across seven ecosystems, with five configurations at one fixed commit per repository. It measures directory-filter and repository-declaration effects, not the true proportion of all test code or a general open-source benchmark. The explicit all-included baseline is not the website default. Full reports, effective rules, complete SHAs and collector hashes are archived at https://octocounts.com/research/filtering-effects-2026-10-27.jsonl . Methods and limitations: https://octocounts.com/research#cross-language-2026-10-27 .