Skip to content

Line Counter

Paste text to count its lines: the total, the non-empty and empty lines, and the longest line. Works with lists, code and logs, and updates as you type.

Runs in your browser. Your data is not uploaded.How our tools work

A line break at the very end doesn’t start a new line. Lines with only spaces count as empty.

Line statistics

Total lines
0
Non-empty lines
0
Empty lines
0
Longest line
0 characters
Average length
0 characters
Per line, empty ones included

How do I count the lines in a text?

Paste or type your text and the line count updates as you type. It also shows how many lines are empty and which line is longest. Empty text has 0 lines, and a line break at the very end doesn’t add a line, as in most editors. Windows, Mac and Linux line endings are all counted correctly.

Key features

  • Total, empty and non-empty

    See how many lines there are, and how many are blank. Lines with only spaces count as empty.

  • Longest line

    Find the length of the longest line and its line number, useful for code, subtitles and CSV files.

  • Every line ending

    Windows (CRLF), classic Mac (CR) and Linux or macOS (LF) line breaks are all recognised.

Common uses

  • Count rows in a list or CSV export
  • Check the length of a poem, script or lyrics
  • Count lines of code or log entries

Line Counter or Word Counter?

If you only need the number of lines, either works: the Word Counter shows a line count too, using the same rule, so the two always agree. Use the Word Counter when you also want words, sentences or reading time.

This page is for lists, code, subtitles and exports, where the shape of the lines matters. It splits the total into non-empty and empty lines, gives the longest line’s length and line number, and the average length. Its box doesn’t wrap long lines, so each row you see is one line of your text. For example, a CSV with the lines “id,name”, “1,Ann”, an empty line and “2,Bob”, ending in a line break, shows 4 lines, 3 non-empty and 1 empty, a longest line of 7 characters on line 1, and an average of 4.3 characters.

Why another program shows a different count

Line counts differ for a few predictable reasons, and none of them means a count is wrong.

  • The wc -l command counts line breaks, not lines, so a text without a final line break shows one fewer there: “one⏎two” is 2 lines here and 1 in wc -l.
  • A spreadsheet export usually starts with a header row, so 101 lines is 100 records.
  • In a CSV file, a cell with a line break inside quotes spreads one record over two lines.
  • Text that wraps on screen is still one line; only line breaks start a new one.

Frequently Asked Questions

Does a line break at the end count as a line?

No. “one⏎two⏎” is two lines, as most editors and the wc -l command count it. A blank line in the middle does count.

Are lines with spaces counted as empty?

Yes. A line that contains only spaces or tabs counts as empty, because it shows nothing.

Last updated: