Skip to content

Line Counter

Paste a list, a poem, a log or any block of text and see how many lines it has. The counter separates non-empty lines from blank ones and reports the longest, shortest and average line length in characters. Free, no sign-up, and nothing is uploaded.

0

Total lines

0

Non-empty lines

0

Blank lines

0

Longest line (chars)

0

Shortest line (chars)

0.0

Average line length

How to Use the Line Counter

  1. Paste your text. One item per line works best: a list of names, a column copied from a spreadsheet, a poem or a block of code.
  2. Read the total. Total lines is the number of line breaks plus one, so an empty box is 0 and a single line of text is 1.
  3. Compare non-empty and blank lines. A line made only of spaces or tabs counts as blank.
  4. Check the lengths. Longest, shortest and average line length are measured in characters over the non-empty lines only.

What Counts as a Line

A line here is whatever sits between two line breaks, the Enter keystrokes you typed or pasted. It is not a row on your screen. If a long sentence wraps across three rows because the window is narrow, it is still one line, and resizing the window does not change the count.

That makes the counter deterministic, but it differs from the Lines figure in the Microsoft Word count dialog, which counts the rows of text as laid out on the page and so changes with font, margins and page width. Use this page to count lines you made with Enter, and use Word for rows on a printed page.

A Worked Example

Type four lines, with the third left empty: First line, Second line, an empty line, then Fourth line. The counter reports:

StatisticResultWhy
Total lines4Three line breaks plus one.
Non-empty lines3The empty third line is not counted.
Blank lines1Total minus non-empty.
Longest line11 charactersSecond line and Fourth line are both 11.
Shortest line10 charactersFirst line, counting the space.
Average line length10.7(10 + 11 + 11) ÷ 3, over non-empty lines only.

Watch the trailing line break

If your text ends with Enter, the cursor sits on a final empty line and the counter adds it, so "a" then "b" then Enter shows 3 lines and 1 blank. The Unix command wc -l counts line-break characters instead, so it would report 2 for the same text. Delete the trailing break when you want that figure.

Common Uses

  • Lists. Check how many names, IDs, URLs or search terms you have pasted, or how many rows a spreadsheet column held.
  • Poems and lyrics. Count the lines in a stanza or compare against a form such as a 14-line sonnet. For syllables per line, use the Syllable Counter.
  • Code, logs and data. Estimate the size of a file or find how many blank lines separate records.
  • Clean-up. Spot hidden blank lines before you remove them with the Remove Line Breaks or Remove Duplicate Lines tools.

Which Tool Do You Need?

If you want…Use
Words, characters and sentencesWord Counter
Blocks separated by blank linesParagraph Counter
Numbers added to the start of each lineAdd Line Numbers
Duplicate lines removedRemove Duplicate Lines
Syllables on each line of a poemSyllable Counter

Frequently Asked Questions

How do I count the lines in a text?
Paste the text into the box. The total updates immediately and equals the number of line breaks plus one. Blank lines are included in the total and also listed separately.
Does a wrapped line count as one line or two?
One. The counter counts lines you ended with Enter, not rows on the screen, so changing the window width or font never changes the result. Microsoft Word's own Lines figure counts laid-out rows and will differ.
Are lines with only spaces counted as blank?
Yes. A line that contains only spaces or tabs is treated as blank, which keeps stray whitespace from inflating the non-empty count. Its length is also left out of the longest, shortest and average figures.
Why is my line count one higher than wc -l?
The command wc -l counts newline characters. A text that ends with a newline has one fewer newline than lines in this counter, because the final empty line after it counts here. Remove the last line break to match the command.
Is the line length counted in characters or bytes?
Characters, as the browser stores them. Most letters count as one, while some emoji count as two. For bytes and code points, use the Unicode Character Inspector.
Is my text stored or sent anywhere?
No. The lines are counted in your browser and the text is not uploaded or saved.

Related Tools

More in Counters & Readability

See all Counters & Readability