Line Counter

Paste any text to count its lines, skip the blanks, and see longest and average line lengths — useful for code, CSVs, and lists.

—
Total lines
—
Non-empty lines
—
Longest line (chars)
—
Average line length

How it works

Total lines counts every line-break-separated row, including empty ones, so trailing newlines matter. Non-empty lines ignores rows that are blank or contain only whitespace — the number you care about for a list of names or URLs. Longest line reports the character count of the widest row, which helps spot runaway lines in code or data files. Average line length divides total characters by the number of lines, giving a quick sense of how dense the text is. All four stats recalculate instantly as you edit.

How to use

  1. Paste any text into the box — the fruit-list sample shows the format.
  2. All four statistics recalculate instantly as you edit: total lines, non-empty lines, longest line, and average line length.
  3. Use non-empty lines when you want the real count of items in a list of names, URLs, or email addresses.
  4. Scan the longest-line figure when checking data files: a longest line far above the average often means a runaway row worth inspecting. Comparing average line length before and after reformatting a file shows whether the cleanup actually worked.

Frequently asked questions

Do blank lines count toward the total?

Yes — “total lines” counts every line-break-separated row, including empty ones and trailing newlines. “Non-empty lines” skips rows that are blank or contain only whitespace.

What does “longest line” tell me?

The character count of the widest row. It is useful for spotting overlong lines in code or CSV rows that accidentally contain extra fields. In code, a common culprit is a minified bundle pasted by accident — one enormous “line” thousands of characters long.

How is the average line length computed?

Total characters divided by the number of lines — a quick read on how dense the text is. Code with short lines and prose paragraphs give very different averages. A sudden jump in the average after pasting usually means stray blank lines came along for the ride.

Why do total lines and non-empty lines differ?

Because of blank rows, trailing newlines at the end of pasted text, and whitespace-only lines: they all count toward the total, but none of them count as non-empty.