Home / Line counter

Line counter

Paste text to count its lines: all lines, non-empty and empty ones, unique and duplicate lines, words and characters. The result box adds line numbers.
Your text never leaves your device: everything runs in this page. No upload, no sign-up.

Your text or list

Empty

With line numbers

What it counts

NumberWhat it means
LinesEvery line, including empty ones. A single line break at the very end is not counted as an extra line.
Non-empty linesLines with at least one visible character. Lines with only spaces count as empty.
Unique linesDifferent non-empty lines. Capitals and extra spaces are ignored unless you switch that off.
Duplicate linesNon-empty lines that repeat an earlier line.
WordsLetters or digits, joined by apostrophes or hyphens, so don't and e-mail each count as one word.
CharactersEvery character, with spaces and line breaks. Most emoji count as one; flags and combined emoji (skin tones, families) count as several, as they do in most character counters.
Longest lineThe length of the longest line, and which line it is.

Add line numbers

The right-hand box shows your text with a number at the start of each line. Choose the style: 1. , 1) , 1: , a number and a tab (pastes into two Excel columns), or zero-padded 001. Turn on Do not number empty lines to number only the lines with text.

Counting lines elsewhere

In Excel, =COUNTA(A:A) counts the non-empty cells of a column. On Mac or Linux, wc -l file.txt counts line breaks, which can be one fewer than the lines you see if the last line has no break. This page counts the lines you see.

Related tools

Questions

How do I count the number of lines in a text?

Paste it into the box. The Lines figure updates as you type.

Are empty lines counted?

Lines counts all of them. Non-empty lines leaves out empty lines and lines with only spaces.

How do I count unique lines?

Look at Unique lines. Duplicate lines shows how many lines repeat an earlier one.

Can I add line numbers to my text?

Yes. The result box adds them; pick the number style and copy it.