toolqik

151 · Text

Line Counter

Count lines, blank lines and non-empty lines, and find the longest line.

Runs in your browser

About this tool

Count the lines in a list, a log, a CSV export, a block of code or any pasted text. The counter shows the total number of lines, how many have content and how many are blank, the longest line and where it is, and a table with the length of every line.

When line counts matter

  • Lists and exports: check that a list of emails, IDs or URLs has the number of entries you expect, ignoring blank lines.
  • CSV files: the number of non-empty lines minus the header is usually the number of records (quoted fields can contain line breaks, so check with a CSV tool for exact counts).
  • Code style: many style guides limit line length to 80, 100 or 120 characters. The longest-line card and the table show which lines are too long.
  • Logs: count entries in a pasted log excerpt.

How lines are counted

Lines are separated by line breaks, whether Windows (CRLF), Unix (LF) or old Mac (CR). A line containing only spaces counts as blank. If your text ends with a line break, the empty line after it is counted, which matches what most editors show; wc -l on the command line counts line breaks instead, so it can be one lower.

To clean up a list, use remove empty lines, remove duplicate lines or sort lines.

FAQ

How do I count the number of lines in text?

Paste the text into the box. The total number of lines, non-empty lines and blank lines appear instantly.

Are empty lines counted?

Yes, in the total. The non-empty and blank line cards show them separately, and a line with only spaces counts as blank.

Why is my count one more than wc -l?

wc -l counts line break characters. If the text ends with a line break, this counter also counts the empty line after it, like most text editors do.

Can I see which line is the longest?

Yes. The “Longest line” card shows its length and line number, and the table lists the length of every line.

esc
↑↓ navigate↵ open