1<!doctype html> 2<html lang="en"> 3 <head> 4 <meta charset="UTF-8" /> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" /> 6 <meta name="description" content="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." /> 7 <meta name="robots" content="index,follow,max-image-preview:large,max-snippet:-1" /> 8 <meta name="application-name" content="OctoCounts" /> 9 <meta name="apple-mobile-web-app-title" content="OctoCounts" /> 10 <meta name="keywords" content="SLOC counter, GitHub line count, source lines of code, count lines of code, tokei web app, repository size, code metrics" /> 11 <meta name="theme-color" content="#151d1a" /> 12 <meta name="theme-color" media="(prefers-color-scheme: light)" content="#f2eee4" /> 13 <link rel="canonical" href="https://octocounts.com/badges" /> 14 <link rel="alternate" type="text/plain" href="https://octocounts.com/llms.txt" title="OctoCounts LLM summary" /> 15 <link rel="help" href="https://octocounts.com/docs/github-sloc-counter" /> 16 <link rel="icon" href="/favicon.ico" sizes="any" /> 17 <link rel="icon" type="image/png" sizes="32x32" href="/favicons/favicon-32x32.png" /> 18 <link rel="icon" type="image/png" sizes="16x16" href="/favicons/favicon-16x16.png" /> 19 <link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon.png" /> 20 <link rel="manifest" href="/site.webmanifest" /> 21 <link rel="preconnect" href="https://api.octocounts.com" crossorigin /> 22 <link rel="preload" as="font" href="/fonts/jetbrains-mono-800-latin.woff2" type="font/woff2" crossorigin /> 23 <link rel="preload" as="font" href="/fonts/jetbrains-mono-700-latin.woff2" type="font/woff2" crossorigin /> 24
24<script>{let t=null;try{t=localStorage.getItem("octocounts.theme")}catch{}document.documentElement.dataset.scheme="matrix"===t||"paper"===t?t:matchMedia("(prefers-color-scheme: dark)").matches?"matrix":"paper"}try{const p=new URLSearchParams(location.search),l=p.get("lng")||localStorage.getItem("i18nextLng")||navigator.language.split("-")[0];if(l&&l!=="en")document.documentElement.lang=l}catch{}</script>
24 25
25<script defer src="https://cloud.umami.is/script.js" data-website-id="4f3a87a4-fd4c-4dc5-8959-8fcf93e858c7"></script>
25 26 <!-- Open Graph --> 27 <meta property="og:type" content="website" /> 28 <meta property="og:url" content="https://octocounts.com/badges" /> 29 <meta property="og:site_name" content="OctoCounts" /> 30 <meta property="og:locale" content="en_US" /> 31 <meta property="og:title" content="GitHub SLOC badges for your README | OctoCounts" /> 32 <meta property="og:description" content="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." /> 33 <meta property="og:image" content="https://octocounts.com/og-image.jpg" /> 34 <meta property="og:image:alt" content="OctoCounts source line count report preview" /> 35 <meta property="og:image:width" content="1200" /> 36 <meta property="og:image:height" content="630" /> 37 <!-- Twitter Card --> 38 <meta name="twitter:card" content="summary_large_image" /> 39 <meta name="twitter:title" content="GitHub SLOC badges for your README | OctoCounts" /> 40 <meta name="twitter:description" content="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." /> 41 <meta name="twitter:image" content="https://octocounts.com/og-image.jpg" /> 42 <title>GitHub SLOC badges for your README | OctoCounts</title> 43 <!-- No aggregateRating here: Google's structured-data policy requires a 44 rating asserted on a page to be visibly displayed on that same page, 45 and octocounts.com has no rating UI. The real 5.0/118 figure lives on 46 the Chrome Web Store listing itself (linked via downloadUrl/sameAs 47 below) â assert it there, not here. --> 48
48<script type="module" crossorigin src="/assets/index-DanONFSR.js"></script>
48 49 <link rel="modulepreload" crossorigin href="/assets/vendor-react-QBdHTLhB.js"> 50 <link rel="modulepreload" crossorigin href="/assets/vendor-query-DvxQDmy6.js"> 51 <link rel="modulepreload" crossorigin href="/assets/vendor-i18n-D25i1uPq.js"> 52 <link rel="stylesheet" crossorigin href="/assets/index-GpF5g-Bf.css"> 53
53<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","@id":"https://octocounts.com/badges#webpage","name":"GitHub SLOC badges for your README | OctoCounts","description":"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.","url":"https://octocounts.com/badges"},{"@type":"FAQPage","@id":"https://octocounts.com/badges#faq","mainEntity":[{"@type":"Question","name":"Will the badge slow down my README?","acceptedAnswer":{"@type":"Answer","text":"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."}},{"@type":"Question","name":"Can I badge a single language instead of the whole repository?","acceptedA
53nswer":{"@type":"Answer","text":"Yes. Add a `?lang=\u003clanguage>` 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."}},{"@type":"Question","name":"Does the badge update automatically as the repository changes?","acceptedAnswer":{"@type":"Answer","text":"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."}}]}]}</script>
53 54</head> 55 <body> 56 <div id="root"><section><h1>GitHub SLOC badges for your README | OctoCounts</h1><p>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.</p><p>JavaScript runs the interactive builder in your browser; this summary exists so the link preview and crawlers see a real page.</p><h2>How to add a badge</h2><ol><li>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.</li><li>Enter a public GitHub repository URL and copy the generated markdown snippet.</li><li>Paste the markdown into <code>README.md</code>. The badge renders live line counts from the OctoCounts badge API and links to a permanent, commit-pinned SLOC report.</li></ol><h2>Badge types and URLs</h2><ul><li>Summary: total lines and code lines: <code>https://api.octocounts.com/badge/:owner/:repo</code></li><li>Code lines only: <code>https://api.octocounts.com/badge/:owner/:repo?type=code</code></li><li>Total lines: <code>https://api.octocounts.com/badge/:owner/:repo?type=lines</code></li><li>File count: <code>https://api.octocounts.com/badge/:owner/:repo?type=files</code></li><li>Comment lines: <code>https://api.octocounts.com/badge/:owner/:repo?type=comments</code></li><li>Language count: <code>https://api.octocounts.com/badge/:owner/:repo?type=languages</code></li><li>Top language: <code>https://api.octocounts.com/badge/:owner/:repo?type=top-language</code></li><li>Code share percentage: <code>https://api.octocounts.com/badge/:owner/:repo?type=ratio</code></li><li>Single language lines: <code>https://api.octocounts.com/badge/:owner/:repo?lang=rust</code></li></ul><h2>Example markdown</h2><pre><code>[](https://octocounts.com/github/huanglizhuo/OctoCounts)</code></pre><p>Badges can be pinned to a branch, tag, or commit: <code>https://api.octocounts.com/badge/:owner/:repo/branch/:branch</code>. Example report: <a href="/github/huanglizhuo/OctoCounts">huanglizhuo/OctoCounts</a>.</p><h2>Badge FAQ</h2><h3>Will the badge slow down my README?</h3><p>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.</p><h3>Can I badge a single language instead of the whole repository?</h3><p>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.</p><h3>Does the badge update automatically as the repository changes?</h3><p>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.</p><nav aria-label="Related OctoCounts pages"><ul> 57 <li><a href="/">OctoCounts home: count any public GitHub repository</a></li> 58 <li><a href="/recent">Recently analyzed repositories</a></li> 59 <li><a href="/popular">Popular SLOC reports</a></li> 60 <li><a href="/docs/github-sloc-counter">GitHub SLOC counter guide</a></li> 61 <li><a href="/docs/api">OctoCounts API docs</a></li> 62 </ul></nav></section></div> 63 <!-- Cloudflare Pages Analytics -->
vendor: 99 bytes, line 63
63<script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "
6371af94b0ca2c4711a817b0cb99d9eb5b
vendor: 13 bytes, line 63
63"}'></script>
63<!-- Cloudflare Pages Analytics -->
63<script type="module" src="https://static.cloudflareinsights.com/beacon.min.js/v31edd6df95cf4e85bb4c19e7a9bdbcba1788362987495" integrity="sha512-iIg7k2xntmwu6/uSb5tpc/hySgZc4eoL31yB29W6tJFo2akwjPWcEqnCEdJvGexCL0KEQwVYv5BlowfhVz26hg==" data-cf-beacon='{"version":"2024.11.0","token":"236ed5144ce44b0c9b780a2b74cdf95f","r":1,"spa":2}' crossorigin="anonymous"></script>
vendor: 1 bytes, line 63
63
64<script>(function(){function c(){var b=a.contentDocument||(a.contentWindow&&a.contentWindow.document);if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'a4024f6b2bcfd2e5',t:'MTc5MDI1ODM3Mg=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();</script>
64</body> 65</html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.