sloc is a simple, fast tool for counting lines of code that’s designed to be used from both the command line and Node.js scripts. It tallies physical lines, source lines, comment lines, and blank lines, giving you a quick snapshot of code size across files or entire directories. The utility is language-aware through lightweight detectors and patterns, so it can ignore comments correctly and avoid counting generated or minified files if you configure it to. Output can be human-readable for quick checks or machine-readable (like JSON) for CI pipelines that track repository growth over time. It supports typical developer conveniences such as glob patterns, file/directory ignores, and sensible defaults so you can drop it into existing workflows without fuss. Teams often wire sloc into build steps to watch trends, compare modules, or enforce thresholds before merging changes, making it a handy maintenance metric rather than a vanity number.

Features

  • Counts physical lines, source code lines, single-line comments, block comments, mixed source/comment lines, and empty lines
  • Detects lines containing TODOs
  • Outputs results as plain table, CSV, or JSON
  • Can be used via CLI or as a Node.js module in projects
  • Installable globally (npm install -g sloc) or locally as a dependency
  • Lightweight and streamlines SLOC analysis

Project Samples

Project Activity

See All Activity >

Categories

Code Editors

License

MIT License

Follow SLOC

SLOC Web Site

Other Useful Business Software
Our Free Plans just got better! | Auth0 Icon
Our Free Plans just got better! | Auth0

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your security. Auth0 now, thank yourself later.
Try free now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of SLOC!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

CoffeeScript

Related Categories

CoffeeScript Code Editors

Registered

2025-08-22