Lines of Code Counter (Code, Comment and Blank, Per Language)

Counts code, comment and blank lines in pasted source. Start each file with a line like === src/app.py and you get a per-language table with totals.

Use the tool

Why this tool exists

A raw line count mixes real code with comments and empty lines. Tools like cloc solve that, but you may not be able to install anything or want to upload the code.

This counter reuses a string-aware scanner so comment markers inside strings are not counted as comments. Language is picked from the file extension on the === line. A line with code and a trailing comment counts as code. Multi-line strings count as code.

How to use it

  1. Paste your source. For several files add a "=== path/file.ext" line before each.
  2. Pick the fallback language for text without such a line.
  3. Read the table and the per-file lines.

Frequently asked questions

Which languages are known?

C-style languages (JS, TS, Java, C, C++, C#, Go, Rust, PHP and more), CSS, Python, shell/Ruby/YAML, SQL and HTML/XML.

How is a mixed line counted?

As code.

Can I drop files?

Not here. Paste the text, as nothing is uploaded.

Do the numbers match cloc?

They can differ in edge cases such as docstrings and multi-line strings.