OmniTools
textDifficulty: 1/5

Line Counter

Count total, non-empty, blank and whitespace-only lines, detect the line-ending style, and see the longest and average line length.

How lines are counted: A trailing newline is a terminator and not a separator, so "a\nb\n" is two lines — matching wc -l and every editor gutter. An empty line (zero characters) is counted separately from a whitespace-only line (spaces or tabs only) because they behave differently in code, YAML and diffs. Your text is never modified: line endings are normalised for analysis only.

How it works

  1. Type or paste your text into the text area.
  2. Line statistics update automatically as you type.
  3. Copy a plain-text summary of the results.
Privacy & Processing: Everything runs in your browser. Nothing you enter is uploaded, stored, or sent to analytics.

Frequently Asked Questions

Why does my count differ from my editor?

Usually because of the trailing newline. This tool treats a final newline as a TERMINATOR, not a separator, so "a\nb\n" is two lines — which matches wc -l and every editor gutter. A tool that reports three is counting the empty string after the last newline.

What is the difference between an empty and a whitespace-only line?

An empty line has zero characters. A whitespace-only line contains spaces or tabs but nothing visible. They are counted separately because they behave differently in code, in YAML and in diffs — collapsing them is why many "non-empty line" counts are wrong.

Does it change my text?

No. Line endings are normalised for ANALYSIS only; the text you pasted is never modified and nothing is written back.

What does "mixed" line endings mean?

The text contains more than one style — for example some lines end with CRLF and others with LF. That usually indicates a file edited on both Windows and Unix, and it is worth knowing because it produces spurious diff noise.

Related Tools