GitHub SLOC badges for your README

Live README badges showing lines of code, code lines, files, comments, top language, or code share for a public GitHub repository via 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 live SLOC report; saved report IDs and exports preserve the measured version subject to cache retention.

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

What is an OctoCounts badge?

A small live image you embed in a README that shows repository SLOC stats and links to the live OctoCounts report page.

How do I add a badge to my README?

Pick a badge type above, copy the Markdown snippet, and paste it into your README.md where you want the badge to appear.

Will the badge slow down my README?

No. Badges are small SVG images served through a CDN: branch badges stay cached at the edge for up to a day and tag or commit badges for up to a week, and GitHub's image proxy caches them as well, so most views never reach the OctoCounts API.

Can I show a single language instead of the whole repo?

Yes. Select 'Single language' in the badge builder and enter the language name, for example Rust or TypeScript, or add ?lang=rust to any badge URL. Language names are case-insensitive.

Does the badge update automatically?

Branch badges do. A default-branch or branch badge picks up the ref's latest commit once its cached copy expires, within a day, and counts that commit if it has no report yet. Tag and commit badges stay pinned to that exact ref.