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/ Your data stays in your browser.
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?
- Paste or type your text, log excerpt or list in the input box: one line is one item.
- Choose whether whitespace-only lines are empty, whether to trim each line and whether duplicates ignore case.
- 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:
apple banana Cherry banana apple fig A much longer line that is the longest one of this list fig
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.
Related tools
Word Counter
Paste an essay, article or caption and get words, characters, sentences, paragraphs, reading time and the most used words instantly.
Text Tools
Character Counter
See exactly how long your text is in characters, Unicode code points and bytes, and how many characters remain before a limit.
Text Tools
Remove Duplicate Lines
Paste a list and keep only unique lines, in the original order or sorted, with a count of what was removed.
Text Tools
Remove Empty Lines
Strip blank lines from pasted text in one click, or keep a single blank line between paragraphs.
Text Tools
Sort Lines
Order any list one item per line: A to Z, Z to A, natural, numeric or by length.
Text Tools
Text Analyzer
A one-stop inspector for any string: size, character statistics, cryptographic digests and the raw bytes behind it.
Text Tools
Add Prefix / Suffix to Lines
Put the same text at the start and end of each line, or number the lines automatically.
Text Tools