Line Counter
Count total lines, blank lines, non-blank lines, and average line length.
$text
0 chars1 lines
0
Total Lines
0
Non-Blank
0
Blank Lines
0
Longest Line
0
Shortest Line
0
Avg Length
Related Tools
WcWord Counter
Count words, characters, sentences, and lines in any text.
CcCharacter Counter
Count characters, unique characters, and find the most frequent character in text.
--Remove Empty Lines
Remove all blank and whitespace-only lines from text.
AzSort Lines
Sort text lines alphabetically, numerically, or in reverse order.
FAQ
- What counts as a blank line?
- A blank line is any line that contains only whitespace characters (spaces, tabs) or no characters at all. Lines with at least one non-whitespace character are counted as non-blank.
- How is average line length calculated?
- Average line length is calculated by summing the character counts of all non-blank lines and dividing by the number of non-blank lines. Blank lines are excluded from this calculation to give a more meaningful average.
- Does the last line count if it has no newline at the end?
- Yes. The tool counts all lines including the final line even if it does not end with a newline character. This matches the behavior of most text editors and line-counting utilities.
The Line Counter analyzes text line by line, reporting total line count, blank line count, non-blank line count, the longest line length, the shortest non-blank line length, and average line length. Useful for working with code files, log analysis, CSV data, and any text where line structure is important.