Home / Text tools / Line counter

Line Counter

Paste or type any text and see how many lines it has, how many are blank, and how long the longest line is.

0Total lines
0Non-empty lines
0Blank lines
0Longest line
0Average line length
0Line endings

What it counts

The counter splits your text at every line break and reports the total number of lines, the non-empty lines, the blank lines, the length of the longest line and the average line length. It also detects which line endings your text uses. Results update as you type, and nothing leaves your browser.

How lines are defined

  • A line is any run of text ended by a line break. A final line break does not add an extra empty line.
  • Wrapped text is not counted twice. A long sentence that wraps on screen is still one line.
  • By default, a line with only spaces or tabs counts as blank. Untick the option to count it as a line with content.

Why other tools show a different number

Counts differ for three common reasons. Some tools count the empty line after a final line break. Some count wrapped screen lines instead of real lines. Others count only line break characters, so a last line without a break is missed. This tool counts real lines and tells you which line ending style it found.

Example

The text one, two, three on separate lines, followed by a blank line and then four, has 5 lines in total: 4 with content and 1 blank.

Common uses

Check the length of a poem, script or log file, confirm that a list has the expected number of entries, or find unusually long lines before importing data.

Need to ignore empty lines? Use the non-empty line counter. To count source code, comments and blanks separately, try the code line counter. See the guide to counting lines for command line methods, or count words with the word frequency counter.

Frequently asked questions

Does a trailing line break add a line?

No. A final line break ends the last line and does not create an extra empty one.

Are wrapped lines counted separately?

No. Only real line breaks count, so a long wrapped paragraph is one line.

What counts as a blank line?

A line with no characters. By default, a line with only spaces or tabs is also treated as blank.

Is my text uploaded?

No. Counting happens in your browser and nothing is sent to a server.