How Line Counter Works
The tool splits your text at every line break to get the total line count, including any blank lines. It then filters out lines that contain only whitespace to report a second, non-blank line count — useful for seeing how much of a pasted block is actually content versus spacing.
How to Use This Tool
- Paste or type your text into the box.
- The total and non-blank line counts update automatically.
- Use Clear to reset and count a different block of text.
Example
The text "Line one\n\nLine three\n" has 4 total lines (the trailing line break creates an empty final line) but only 2 non-blank lines.
Helpful Tips
- A trailing line break at the end of your text adds one extra empty line to the total count — this matches how most text editors and version control tools count lines.
- Use the non-blank count when you want to know how many lines of actual content a file or list has, ignoring spacing.
- This is handy for quickly checking the size of a pasted code snippet, log file, or list before processing it further.
Frequently Asked Questions
Does an empty text box count as 1 line or 0?
An empty input shows 0 lines, since there's no text to split into lines.
Why is my total line count higher than the number of lines I can see?
A line break at the very end of your text creates one additional, empty final line, which is included in the total count.
What counts as a "blank" line?
A line that contains nothing, or only spaces and tabs, is treated as blank and excluded from the non-blank count.
Can I use this to count lines in code?
Yes, pasting code works the same way as plain text — every line break is counted, regardless of the content on each line.
This tool runs entirely in your browser. Your input is not uploaded to any server.