# OctoCounts

> Free source lines of code counter for public GitHub repositories, with a web app, browser extensions, API, CLI, GitHub Action and MCP server.

OctoCounts is a free source lines of code (SLOC) counter for public GitHub repositories, built and maintained by indie developer huanglizhuo. Paste a repository URL to get files, code, comment and blank line totals per language, without cloning or signing up. It is open source under the MIT license and uses tokei for counting.

## What It Is

OctoCounts fills a gap in GitHub's interface, which shows language percentages but not file or line counts. It resolves a branch, tag or commit to a pinned commit hash, downloads a compressed archive instead of a full git clone, skips generated folders such as node_modules, vendor and .git, and counts the source with tokei. The result is a report with files, total lines, code, comments and blanks per language and in aggregate.

## Workflow and Outputs

Reports are cached by owner, repo, commit SHA and tokei version, so repeat analyses of the same commit return instantly. Advanced options include profiles, ignoring directories or languages, and including docs, tests or generated files. Results can be exported as plain text, JSON, or a 1200 × 630 PNG card, and each report has a stable URL. Live README badges are available.

## Comparison and Automation Tools

Beyond single-repo analysis, OctoCounts offers a compare view for two repositories side by side and a ref diff view showing growth between two refs of one repository. It also provides an API, a CLI run via npx with text or JSON output, a GitHub Action that comments SLOC changes on pull requests, and an MCP server that supplies SLOC reports to agent workflows and developer assistants.

## Browser Extension

Extensions for Chrome, Edge and Firefox add a compact SLOC card to the GitHub repository sidebar. Clicking it opens a panel with totals and a per-language breakdown, with a local cache for repeat visits and settings for auto-analyze and card placement. No GitHub account or token is required.

## Scope and Limits

OctoCounts analyzes public repositories only; it does not support private repositories or source-code uploads. For private code, the site suggests running tokei locally.

## Features
- Per-language SLOC counts (files, lines, code, comments, blanks)
- No clone: downloads commit-pinned archive
- Commit-level report caching
- Advanced options: ignore dirs/languages, include docs/tests/generated
- Compare two repositories
- Diff one repository across two refs
- README badges and stable report URLs
- Export to text, JSON and PNG card
- Public API
- CLI via npx
- GitHub Action for pull request SLOC comments
- MCP server for agent workflows
- Browser extension with sidebar SLOC card and local cache
- 200+ languages via tokei

## Integrations
GitHub, tokei, Chrome, Microsoft Edge, Firefox, GitHub Actions, MCP

## Platforms
ANDROID, WEB, API, BROWSER_EXTENSION, CLI

## Pricing
Free

## Links
- Website: https://octocounts.com/
- Documentation: https://octocounts.com/docs/api
- Repository: https://github.com/huanglizhuo/OctoCounts
- EveryDev.ai: https://www.everydev.ai/tools/octocounts
