Example: sizing up a pasted email list
Before importing contacts into a mailing tool that charges by the address, a consultant pastes in a list a client emailed over. It looks like six addresses, but the counter tells a different story.
Two of the six lines are empty (one only holds spaces), and of the four with content, only three are unique, because hello@brightsmile.example appears twice. Three real contacts, not six. The longest line is 29 characters, the Kestrel Roofing address, which also confirms nothing has been run together on one line.
hello@brightsmile.example bookings@harbourcafe.example hello@brightsmile.example sales@kestrel-roofing.example
Lines 6 Non-empty 4 Empty 2 Unique 3 Longest line: 29 characters
Counting lines
Paste the text
Anything with line breaks: a column copied from a spreadsheet, a list of domains, a log, a block of code.
Read the four totals
Lines counts every line, including blank ones. Non-empty and Empty split them. A line holding only spaces or tabs counts as empty.
Check for repeats
Unique counts distinct non-empty lines after trimming spaces from each end. If it is lower than Non-empty, the list has duplicates.
Details that change the count
Unique lines are compared exactly, letter for letter, so Hello@ and hello@ count as two different lines even though they are the same mailbox in practice. To fold those together, run the list through the remove duplicate lines tool with case sensitivity off.
If the text ends with a line break, as files saved by most editors do, the counter sees one more empty line at the very end. That is correct but can make a 100 row export look like 101 lines; the Non-empty figure is the one to compare with a row count.
- Longest line is measured in characters as a reader sees them, so an accented letter or an emoji counts as one.
- Long lines that wrap on screen still count as a single line; only real line breaks start a new one.
Questions people ask
How do I count the number of lines in a text?
Paste the text into the box and read the Lines figure, which counts every line break plus one. If you only want lines that actually contain something, use Non-empty instead. In Excel, the equivalent for a column is the COUNTA function, which skips empty cells.
Why does the line count not match my spreadsheet rows?
Usually because of a header row, blank rows, or a line break at the end of the pasted text. Compare the Non-empty figure with the spreadsheet's row count minus any header. A cell with a line break inside it will also add an extra line when copied.
Can it count lines in a file?
Open the file in a text editor or spreadsheet, select everything and paste it here. The counter works on pasted text rather than uploaded files, so it handles any format that can be shown as text, such as CSV, TXT or a log.
Where your data goes
Counting happens on this page as you paste, using your own device. The list is not uploaded, stored or seen by anyone else.
Checked against the tool on