Paste a list, log file, CSV or any text, or open a .txt file, and instantly see how many lines it has: total, non-empty, blank and unique. Check every line's length, find duplicates and see which lines are the longest.
Last updated:
0Total lines
0Non-empty lines
0Blank lines
0Unique lines
0Duplicate lines
0Longest line (chars)
0Shortest non-empty line
0Average line length
Per-line lengths
Line
Chars
Words
Text
Length distribution
Most repeated lines
Advertisement
Advertisement
How to use the Line Counter
Paste your text into the box, or click Open .txt file (you can also drop a file on the box).
Read the totals: total lines, non-empty, blank, unique and duplicate lines update as you type.
Adjust the options to ignore spaces or letter case when finding unique lines, or to count whitespace-only lines as blank.
Check per-line lengths in the table, sort by longest or shortest, and view the length chart and most repeated lines.
Copy the stats, copy the unique lines, or download a CSV with every line's length.
What each count means
Here is how the counter reads this six-line example (the third line is empty and the fifth contains only spaces):
red
blue
red
green
Count
Result
Why
Total lines
6
Every line, including empty ones
Blank lines
2
Line 3 is empty; line 5 has only spaces (treated as blank by default)
Non-empty lines
4
Total minus blank: red, blue, red, green
Unique lines
3
red, blue and green
Duplicate lines
1
Non-empty minus unique: the second "red"
Longest line
5 characters
"green"
Line endings explained
Name
Characters
Used by
LF
\n (line feed)
macOS, Linux, Android, most web content and code repositories
CRLF
\r\n (carriage return + line feed)
Windows text files, many CSV exports, email and HTTP
CR
\r (carriage return)
Classic Mac OS (before 2001), rare today
The counter treats all three as one line break, so the line count is the same whatever system the file came from. "Mixed" means the text contains more than one style, which often happens when files are edited on different systems; a line ending converter can make them consistent.
Common uses
Lists and spreadsheets: check how many names, emails or SKUs are in a pasted column, and how many are duplicates.
Log files: count entries and spot the longest lines.
Code and config: count lines of code, blank lines and lines over 80 characters.
Poems and lyrics: count lines and stanzas (blank lines separate stanzas).
Data imports: confirm a CSV has the expected number of rows (remember the header row counts as a line).
Frequently asked questions
How are lines counted?
Every line break (LF, CRLF or CR) ends a line. A single line break at the very end of the text does not add an extra empty line, so "apple⏎banana⏎" counts as 2 lines, the same as most code editors. Empty text has 0 lines.
Why is my count one different from wc -l?
The Unix command wc -l counts line break characters, not lines. A file that does not end with a line break has one more line than wc -l reports. The tool shows both: total lines and the number of line breaks.
What counts as a blank line?
A line with no characters is blank. By default, lines that contain only spaces or tabs are also treated as blank; untick "Treat whitespace-only lines as blank" to count them as non-empty.
How are unique and duplicate lines calculated?
Unique lines is the number of different non-empty lines. Duplicate lines is the number of extra copies: non-empty lines minus unique lines. By default leading and trailing spaces are ignored when comparing; you can also make the comparison case-insensitive.
How is line length measured?
Line length is the number of characters on the line, not counting the line break. Emoji and other characters outside the basic plane count as one character, and tabs count as one character.
Can it handle large files?
Yes. Counting runs in your browser and handles files with hundreds of thousands of lines. The table shows the first 2,000 lines, and the CSV download includes every line.
Is my file uploaded?
No. Files are read with your browser's FileReader and never leave your device.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.