Skip to content

Line Counter

Paste a text, a log or a list and get the number of lines, how many are empty or repeated, and which line is the longest.

Processed locally in your browser

Options
A final line break does not add an extra line. Nothing leaves your browser.0 chars · 0 lines
The result will appear here.

What is Line Counter?

A line counter tells you how many lines a text contains, like wc -l does in a terminal, but it goes further. It separates non-empty lines from empty ones, counts distinct lines and duplicate copies, and points to the longest and the shortest line with its line number.

Lines are split on \n, \r\n and \r, and a final line break does not create an extra line. Lengths are counted in Unicode characters, so emoji and accents count once. A table shows the first 500 lines with their number, length and how many times the same line appears in the text.

How does it work?

  1. Paste or type your text, log excerpt or list in the input box: one line is one item.
  2. Choose whether whitespace-only lines are empty, whether to trim each line and whether duplicates ignore case.
  3. Read the totals and the longest and shortest lines, then scan the numbered table to spot repeated lines.

Common use cases

  • Checking how many entries a pasted list, keyword file or email list really contains.
  • Counting the non-empty lines of a log excerpt or a CSV column before importing it.
  • Spotting duplicate lines and the line number of an unusually long value in a config file.
  • Verifying that a script or subtitle file stays within a required number of lines.

Examples

Try this input in the tool above:

Input
apple
banana

Cherry
banana
   
apple
fig
A much longer line that is the longest one of this list
fig
Output
Total lines: 10
Non-empty lines: 8
Empty lines: 2
Unique lines (distinct): 5
Duplicate lines (extra copies): 3
Lines that repeat: 3
Longest line: 55 characters (line 9)
Shortest non-empty line: 3 characters (line 8)
Average line length: 11.1

Privacy

Line Counter runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.

Limitations

Only physical lines are counted: a paragraph wrapped by your editor is still one line. For word or character totals use the Word Counter or Character Counter.

Frequently asked questions

Does the last line break count as a line?

No. A text ending with a line break has the same number of lines as the same text without it, which matches how most editors and wc -l report a file.

What is the difference between unique and duplicate lines?

Unique lines are the distinct non-empty values. Duplicate lines are the extra copies: if "apple" appears three times, it counts once as unique and two as duplicates.

Are lines with only spaces counted as empty?

By default yes, because they look empty on screen. Untick the first option to count only truly empty lines as empty.

More tools in Text Tools →