Blog
Text tools

Line counter online

Paste your text or list and the counter shows the total number of lines, plus non-empty and empty ones separately. Handy for lists, code, CSV files and any text where the exact line count matters.

Result

Lines —
Total lines —
Non-empty lines —
Empty lines —

All calculations run locally in your browser: parsing, chart, export. Disconnect the network and the page keeps working.

Facts and limits of this method

Line A text fragment between line breaks \n (or \r\n)
Empty line A line made up only of whitespace, or with no content at all
Text with no line breaks Counted as a single line
Empty input 0 lines — an empty input field doesn't count as one line

When it misleads you

How it is calculated

The text is split into lines on the line-break character; the resulting array of fragments is the set of lines.

A line is considered empty if nothing is left after trimming whitespace from both ends.

The "show only non-empty lines" toggle decides which number is displayed as the large headline result — the total line count or just the non-empty ones; all three exact numbers (total, non-empty and empty) are always shown on the right regardless of the toggle.

Empty lines is the difference between the total line count and the non-empty line count.

Questions and answers

Does a line with only spaces count as empty?

Yes — if trimming the whitespace from both ends leaves nothing, the line counts as empty, even though it technically contains space characters.

Why does an empty input field show 0 lines instead of 1?

Empty text (no characters at all) doesn't produce any lines. As soon as you type at least one character with no line break, that's already 1 line.

Does a trailing line break at the end of a file increase the count?

No, the extra empty line from a trailing break isn't added — only lines that genuinely exist in the text are counted.

Is my text sent anywhere?

No, the whole count runs in your browser.

Related tools

All tools