Line Counter

Count total, non-empty, blank and unique lines.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

This line counter analyses any pasted text — code, lists, CSV rows or log files — and reports six figures at once: total lines, non-empty lines, empty lines, blank (whitespace-only) lines, unique lines and the longest line length. It is handy for verifying list sizes, finding duplicates and checking line-length limits.

How it works

The tool normalises every line ending (CRLF, lone CR and LF all become a single newline) and removes one trailing newline so the count matches your editor. It then splits the text on newlines and walks each line:

MetricDefinition
Total linesNumber of lines after splitting
Non-empty linesLines with at least one non-whitespace character
Empty linesLines with zero characters
Blank linesLines containing only whitespace (includes empty)
Unique linesNumber of distinct line values
Longest lineCharacter length of the longest line

An empty line has length 0; a blank line may contain spaces or tabs and looks empty but is not, so the two are reported separately.

Example

Given this five-line text (one trailing newline, ignored):

First line
Second line

   
First line
MetricValue
Total lines5
Non-empty3
Empty1
Blank2
Unique4

“First line” appears twice, so unique is 4 rather than 5. All counting happens locally in your browser — nothing is uploaded.

Ad placeholder (rectangle)