Line Counter

Count lines in text: total, with text, blank, different and repeated lines, plus the longest line and average length.

Runs in your browserNo sign-upWorks offline
Ctrl+Enter to run
Input131 characters
Output
✓ ReadySample content shown

What the Line Counter does

The Line Counter counts the lines in any text, such as a list, log file, CSV, code or poem. It shows the total number of lines, how many have text, how many are blank, how many are different, which lines repeat and how often, the longest and shortest lines with their line numbers, and the average line length. Tick the option to ignore spaces at the ends of lines so “apple” and “apple ” count as the same.

How to use it

  1. Paste your text on the left.
  2. Choose whether to ignore spaces at line ends.
  3. Read the counts on the right, or copy them.

Example

The sample list has 6 lines: 5 with text and 1 blank. It has 4 different lines, because “apple” appears twice. The longest line is line 2, “banana”, at 6 characters, and the average line is 5.2 characters long.

Handy for

Checking how many items are in a list before importing it, confirming a CSV has the expected number of rows, finding duplicate entries in mailing lists or inventory codes, and checking line lengths for subtitles, SMS messages or code style rules such as 80 or 120 characters.

To remove the repeats it finds, use Remove Duplicate Lines; to number the lines, use Add Line Numbers.

Questions people ask

Is my text sent anywhere?

No. Everything happens in your browser as you type, so private notes, lists and documents never leave your device.

Does an empty last line count?

Yes, as a blank line, the same way most editors show it.

Is there a size limit?

Not a fixed one. Hundreds of thousands of lines work on a typical computer.

Are Windows and Mac line endings handled?

Yes. Windows (CR LF), Mac and Linux line endings are all counted the same way.

Does it count wrapped lines?

No. Only real line breaks count. A long paragraph that wraps on screen is one line.

Related tools