Line Counter

Count total, non-empty and blank lines in text or code, plus the longest and average line length. Paste any text; nothing leaves your browser.

0
Lines
0
Words
0
Characters
0
Characters (no spaces)
0
Sentences
0
Paragraphs
0
Non-empty lines
0
Blank lines
0
Longest line (characters)
0
Average line length

Every line break starts a new line, including the last line even if it is empty. Line lengths count visible characters (emoji and accented letters count as one).

Runs entirely in your browser. Your data is never uploaded.

What is Line Counter?

Counts how many lines a text has, how many contain something and how many are blank. It also reports the length of the longest line and the average line length, which helps with code style limits and data files.

How to use Line Counter

  1. Paste your text, list, CSV or code into the Input box.
  2. Read Lines in the highlighted card.
  3. Check Non-empty lines and Blank lines for the split.
  4. Use Longest line (characters) to find lines that exceed a length limit.

Example

Input
one

three
Output
Lines: 3 · Non-empty lines: 2 · Blank lines: 1 · Longest line: 5

When to use Line Counter

Use it for quick counts of list items, log lines, CSV rows or lines of code. It does not distinguish comments from code, so it is not a replacement for a source-lines-of-code (SLOC) tool.

How Line Counter works

The text is split on \r\n, \r and \n, so Windows, old Mac and Unix line endings are all handled. An empty input has 0 lines; any other text has one more line than it has line breaks, so a trailing line break produces an empty last line that is counted as blank. A line is blank if it only contains whitespace. Line lengths count grapheme clusters (visible characters), not bytes.

Common Use Cases

  • Counting entries in a list or CSV export
  • Checking how many lines a log excerpt has
  • Finding lines longer than 80 or 120 characters in code
  • Counting non-empty lines after removing blank ones

FAQs

Why does my file show one more line than expected?

If the text ends with a line break, the empty line after it is counted (as a blank line). Many editors also display it as an extra line.

Are tabs counted in the line length?

Yes, a tab counts as one character.

Does it work with Windows line endings?

Yes. CRLF, CR and LF line endings are all recognised.

Good next steps

Explore more categories