GitHub SLOC badges for your README | OctoCounts

Live README badges that show source lines of code, code lines, files, comments, language count, top language, code share, or a single language for any public GitHub repository, rendered by the OctoCounts badge API.

JavaScript runs the interactive builder in your browser; this summary exists so the link preview and crawlers see a real page.

How to add a badge

  1. Open the badge builder above and choose a badge type: summary, code lines, total lines, files, comments, language count, top language, code share, or a single language.
  2. Enter a public GitHub repository URL and copy the generated markdown snippet.
  3. Paste the markdown into README.md. The badge renders live line counts from the OctoCounts badge API and links to a permanent, commit-pinned SLOC report.

Badge types and URLs

Example markdown

[![OctoCounts](https://api.octocounts.com/badge/huanglizhuo/OctoCounts)](https://octocounts.com/github/huanglizhuo/OctoCounts)

Badges can be pinned to a branch, tag, or commit: https://api.octocounts.com/badge/:owner/:repo/branch/:branch. Example report: huanglizhuo/OctoCounts.

Badge FAQ

Will the badge slow down my README?

No. Default-branch and branch badges are served with a 1-hour edge cache and a 24-hour stale-while-revalidate window, and tag or commit badges are cached forever as immutable. GitHub's own image proxy (camo) caches the response again on top of that, so repeat views rarely reach the OctoCounts API at all.

Can I badge a single language instead of the whole repository?

Yes. Add a `?lang=<language>` query parameter to any badge URL, for example `?lang=rust`, to get a per-language line-count badge instead of the full summary. Language names are case-insensitive.

Does the badge update automatically as the repository changes?

Default-branch and branch badges re-analyze on a cache miss, so they reflect new commits once the cache window expires. Tag and commit badges are pinned to that exact ref and never change, which is the right choice for a release README that should show historical numbers.