Zero Signup ToolsFree browser tools

Developer Tools

Lines of Code Counter

Count source lines, comment lines, and blank lines across multiple files and languages. Per-block stats, language totals, and copyable summary.

Lines of code counter

Source blocks

Paste source code, drop one or more files, or add an empty block and start typing. Each block has its own language.

Drop one or many files anywhere in this box

Files are read in your browser. Nothing is uploaded.

C-style

Block stats

Total lines
18
Source (SLOC)
10 (55.6%)
Comment-only
6 (33.3%)
Blank
2 (11.1%)
Mixed (code + comment)
2
Line-comment lines
2
Block-comment lines
6
Longest line
48 chars
Characters
419
Size
419 B

Scripting

Block stats

Total lines
14
Source (SLOC)
9 (64.3%)
Comment-only
2 (14.3%)
Blank
3 (21.4%)
Mixed (code + comment)
0
Line-comment lines
2
Block-comment lines
0
Longest line
43 chars
Characters
264
Size
264 B

Aggregate

32 total lines across 2 blocks

Source lines (SLOC)

19

59.4%

Comment-only lines

8

25.0%

Blank lines

5

15.6%

Lines with trailing comment

2

Longest line

48 chars

Total size

683 B

By language

LanguageSourceCommentBlankTotalSize
TypeScript106218419 B
Python92314264 B

All counts run locally in your browser using a per-language scanner. Source code and files you drop here are never uploaded.

How to use

  1. Paste source code into the existing sample block, click Add block for an empty one, or drop one or more files anywhere in the drop zone.
  2. Pick a language for each block from the dropdown. Files dropped onto the page have their language detected from the file extension automatically.
  3. Read per-block stats on the right of each block: total lines, source lines (SLOC), comment-only lines, blank lines, longest line, and size.
  4. Scroll to the Aggregate card for the project totals and the By language table for a per-language summary.
  5. Click Copy summary for a plain-text recap or Copy CSV to drop a row-per-block table into a spreadsheet.

About this tool

Lines of Code Counter scans one or many source files and reports total lines, source lines (SLOC), comment-only lines, blank lines, lines with trailing comments, line-comment lines, block-comment lines, longest line length, character count, and UTF-8 byte size, all from inside your browser. Each block is classified by language and tokenized with a per-language state machine that walks the input character by character, tracking whether the cursor is inside ordinary code, a string literal, a line comment, or a block comment, so a comment-like sequence inside a string never counts as a comment and a stray quote inside a comment never confuses the scanner. Coverage includes the C family (C, C++, Java, C#, Go, Rust, Kotlin, Swift, Scala, PHP), JavaScript and TypeScript with JSX and TSX (including template literals and ${} interpolations), CSS, SCSS, and Less, HTML, XML, and SVG with HTML-style block comments, JSON, JSON5, JSONC, YAML, TOML, SQL with single-line and block syntax, the scripting family (Python, Ruby, Perl, Shell, Lua, R, Elixir, Haskell), Markdown, and plain text. Shebang lines on Unix-style scripts are treated as comment lines so a Python or Bash file that opens with a hashbang lands in the right bucket. Drop multiple files onto the page and each one is read with the FileReader API, language is detected from the file extension (over forty extensions are mapped), and a per-block panel shows the breakdown alongside a sortable language totals table. The aggregate panel shows SLOC and comment percentages, blank-line percentages, the longest line across the entire project, and the total UTF-8 byte size, which is useful for code review, refactor planning, pull-request triage, school assignment stats, freelance time estimation, and weekly review reports. Copy a plain-text summary for a code review note or copy a CSV with one row per file plus a totals row to drop straight into a spreadsheet. Everything runs locally in your browser; the code and files you drop here are never uploaded to a server.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools