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:
| Metric | Definition |
|---|---|
| Total lines | Number of lines after splitting |
| Non-empty lines | Lines with at least one non-whitespace character |
| Empty lines | Lines with zero characters |
| Blank lines | Lines containing only whitespace (includes empty) |
| Unique lines | Number of distinct line values |
| Longest line | Character 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.
Worked example
Given this five-line text (one trailing newline, ignored):
First line
Second line
First line
| Metric | Value |
|---|---|
| Total lines | 5 |
| Non-empty | 3 |
| Empty | 1 |
| Blank | 2 |
| Unique | 4 |
“First line” appears twice, so unique is 4 rather than 5.
When each metric is useful
Total lines is what most people need first — verifying that a CSV export, list or config file has the expected number of rows.
Non-empty lines is the most reliable count for actual content in lists and code, because it filters both genuinely empty lines and lines that look empty but contain invisible whitespace characters.
Unique lines helps with deduplication tasks. If total is 1,000 and unique is 750, you have roughly 250 duplicate rows to investigate before importing a dataset or mailing list.
Empty vs blank is subtle but important for code style enforcement. Many linters allow a single blank separator line but forbid whitespace-only lines (which can cause diff noise). Reporting them separately lets you catch whitespace-only lines that would otherwise look clean.
Longest line is essential when you have a hard character limit — code style guides (many set 80 or 120 characters), fixed-width data formats, or email text that wraps at a given column. A quick paste tells you immediately whether any line exceeds the limit.
Common uses
- Verifying a scraped or exported list has the expected row count
- Checking a
.envor config file for unexpected blank lines before parsing - Counting lines of code in a single file (use non-empty for a realistic count)
- Spotting duplicate entries in a dataset before import
- Checking maximum line length for code review or formatting compliance
All counting happens locally in your browser — nothing is uploaded or stored.