Line Counter
A line counter splits text at every line break and reports how many lines it holds. Paste four log rows with one blank line between them and a final line break and this page shows Total lines 6, Non-empty lines 4 and Empty lines 2, because that last break opens a sixth, empty line. Lines that contain only spaces or tabs count as empty, and Remove Empty Lines deletes them from the box in one click.
Text workspace
Count logical lines, identify blank lines and remove them from your text.
Method and limits
Paste text to see total, nonempty and empty lines. CRLF, CR and LF separate lines; a final newline adds an empty line. Empty text has zero lines. Removal keeps other line contents.
Screen wrapping does not add lines. Whitespace-only lines are empty. Unlike wc -l, this counts logical lines rather than newline characters.
Try this example
a\n\nb\n has 4 lines: 2 nonempty and 2 empty. Removing empty lines gives a\nb.
Copied
Copy failed. Select the result and copy it manually.
Popular Tools
About Line Counter
Count logical lines, identify blank lines and remove them from your text.
a\n\nb\n has 4 lines: 2 nonempty and 2 empty. Removing empty lines gives a\nb.
Screen wrapping does not add lines. Whitespace-only lines are empty. Unlike wc -l, this counts logical lines rather than newline characters.
Use Cases
How to use
Paste text to see total, nonempty and empty lines. CRLF, CR and LF separate lines; a final newline adds an empty line. Empty text has zero lines. Removal keeps other line contents.
Pro Tips
- Screen wrapping does not add lines. Whitespace-only lines are empty. Unlike wc -l, this counts logical lines rather than newline characters.
Troubleshooting
What should the counters show after Clear?
Clear removes all text and resets total, nonempty and empty lines to 0 / 0 / 0, just like an empty page. No reload is needed. A final newline in nonempty text still adds an empty line.
The page freezes for several seconds when I paste a very long file.
The number column on the left draws one row per line, so its cost grows with the file. In our tests 1,000 lines counted in well under a second, 10,000 lines took a few seconds and 50,000 lines took over a minute. Paste long logs in slices, or run wc -l on the file and add one to its answer.
A line that looks blank is being counted under Non-empty lines.
Something invisible is sitting on it. Spaces, tabs, carriage returns and non-breaking spaces are all ignored, so those still count as empty, but a zero-width space (U+200B) or a stray full stop is content. Delete the line and retype the break, or click Remove Empty Lines and check whether the row survives.
Frequently Asked Questions
Paste text to see total, nonempty and empty lines. CRLF, CR and LF separate lines; a final newline adds an empty line. Empty text has zero lines. Removal keeps other line contents.
Screen wrapping does not add lines. Whitespace-only lines are empty. Unlike wc -l, this counts logical lines rather than newline characters.