How to use the line counter
Paste your text into the box. The total number of lines appears at once, together with non-empty lines, empty lines, unique lines, duplicate lines, the length of the longest line and the average line length. Long lines don't wrap in the box, so each row on screen is one real line and you can scroll sideways to read it.
What counts as a line
A new line starts after every line break. A single line break at the very end of the text does not create an extra empty line, because most files and editors end with one. That means a list of 100 items pasted from a spreadsheet counts as 100 lines whether or not it ends with a line break.
- Empty lines are lines with nothing on them, or only spaces and tabs.
- Unique lines counts the distinct non-empty lines. Two lines that are identical count once.
- Duplicate lines is how many non-empty lines are repeats of an earlier line.
- Longest line is measured in characters, including spaces.
With Ignore leading/trailing spaces ticked, apple and apple count as the same line when finding duplicates. Untick it if spacing matters, for example when checking code indentation.
Common uses
- Checking a list before an import. Count email addresses, SKUs or keywords before you upload them, and make sure the numbers match what the other system reports afterwards.
- Counting rows in a CSV. Paste the file contents to count records. Remember that the header row is included in the total.
- Measuring code. Get the line count of a function or file, and see how many lines are blank.
- Poetry and lyrics. Count lines per stanza or check that verses have the same length.
- Finding duplicates. If the duplicate count is above zero, use Remove Duplicate Lines to clean the list, then Sort Lines to put it in order.
Why other tools may show a different number
The Unix command wc -l counts line break characters rather than lines, so a file whose last line has no line break at the end shows one less. Some code editors show an extra numbered line after a final line break. Spreadsheets count rows, which can differ from lines when a cell contains a line break inside quotes. All of these are correct by their own rules; this counter follows the one most people expect when they look at a list.
Frequently asked questions
Does a blank line at the end count?
A single line break at the end is not counted as an extra line. Two or more line breaks at the end do add empty lines to the total.
How many lines can I paste?
There is no set limit. Tens of thousands of lines are counted instantly because everything runs in your browser.
Does it count wrapped lines?
No. Only real line breaks start a new line. Long lines are shown without wrapping so what you see matches the count.
How do I remove the duplicate lines it finds?
Copy your list into the Remove Duplicate Lines tool. It deletes repeats and keeps the first copy of each line in the original order.
Last updated
