Count the lines in your text, including blank and unique lines.
Processed locally in your browser.
How do you count the lines in a text?
Lines are split on line breaks. Non-empty lines have visible content, blank lines hold only whitespace, and unique lines are counted exactly, with case and spacing significant. The final line counts even without a trailing break. For example, four lines where one is blank and one repeats give 4 total, 3 non-empty, 1 blank and 3 unique.
Understanding your result
The final line is counted even without a trailing line break. Because unique counting is exact, lines that differ only in spacing or case are treated as different.
Formula and method
Lines are split on line breaks. Non-empty lines have visible content; blank lines have only whitespace; unique lines are counted exactly, with case and spacing significant.
Assumptions and limitations
The counter splits your text on line breaks and reports total, non-empty, blank and unique lines plus the longest line's length. Unique counting is exact, so lines differing only in spacing or letter case are counted as distinct. It measures structure rather than meaning, and it does not detect words wrapped visually by your editor as separate lines.
Worked example
Four lines where one is blank and one repeats give 4 total, 3 non-empty, 1 blank and 3 unique.
How to use this tool
- Paste or type your text.
- Read the line counts.
- See the longest line length.
Common mistakes to avoid
- Expecting trailing whitespace differences to be ignored — they are not.
- Confusing line count with word or character count.
About the Line Counter
The Line Counter tallies the lines in your text — total, non-empty, blank and unique — and shows the length of the longest line.
Who should use this tool
Developers, writers and anyone working with lists, logs or code.
Benefits
- Total, non-empty and blank line counts.
- Unique line count.
- Length of the longest line.
- Private — text never leaves your browser.
Practical use cases
- Counting lines in a log or list.
- Checking how many entries are in a paste.
- Finding duplicate or blank lines.
Explore all Text and Writing tools
Frequently asked questions
Is the last line counted without a newline?
Yes. The final line is always counted, whether or not it ends with a line break.
What counts as a blank line?
A line with no visible content — empty or containing only spaces or tabs.
Are lines that differ only in case treated as the same?
No. Unique counting is exact, so Hello and hello are considered two different lines, as are lines that differ only in leading or trailing spaces. This keeps the unique tally precise, though it means near-identical lines will each be counted separately.