Skip to content

Count Lines in Text

Count the lines of your text, and see how many are empty, how many are different, and how long the longest line is.

Line counter
Paste text. The counts update as you type.

Lines
7
5
Lines with text
2
Empty lines
4
Different lines
10 characters
Longest line

Private: Everything runs in this page. Nothing you type is sent anywhere or saved.

On this page
  1. Line count examples
  2. Formula
  3. How the line counter works
  4. What this tool does not do
  5. Frequently asked questions
  6. Related tools

Line count examples

Text (lines separated by a bar)LinesWith textDifferent
a, b, c333
a, , b322
a, a, a331
one111
x, y, , z, 433

Formula

lines = line breaks + 1 (a break at the very end does not start a new line)

How the line counter works

  1. Step onePaste your text into the box.
  2. Step twoRead the number of lines. Lines that hold only spaces count as empty.
  3. Step threeUse the other tiles to see the different lines and the longest line.

What this tool does not do

  • It counts lines made by line breaks; a long line that wraps on screen is still one line.
  • It does not count words or characters; use the word counter for that.
  • Lines that differ only in spaces at the ends count as different lines.

Frequently asked questions

Is a line break at the end of the text counted?

No. Text that ends with a line break has the same number of lines as the same text without it, so the count matches what most editors show.

What counts as an empty line?

A line with nothing in it, or only spaces and tabs.

How are different lines counted?

Exactly equal lines count once. Upper and lower case count as different, and empty lines are left out.