Line Counter

Total, non-empty, and blank lines — live as you paste. Built for the things people actually count lines in: source files, log excerpts, CSV exports, and word lists. Nothing you paste leaves your browser.

0 Lines
0 Non-empty lines
0 Blank lines
0 Characters

What counts as a line — the rules, stated

Line counting looks trivial until the edge cases, so this page fixes three conventions and names them. First, lines split on newline characters, with Windows CRLF pairs normalized so the platform the text came from cannot change the count. Second, a trailing newline terminates the last line instead of adding a phantom empty one — the four-character text "a↵b↵" is 2 lines, exactly what wc -l reports and what your editor's gutter shows for a file with a final newline. Third, a line containing only spaces or tabs is counted, but counted as blank: the text "a↵b↵↵c" is 4 lines — 3 non-empty and 1 blank — and the two figures always sum to the total, so nothing is silently dropped or double-counted.

Counting code and log files

For source code, the non-empty figure is the closest thing to a quick size estimate — blank lines are formatting, not content. It is not a true SLOC metric (comment lines still count, and one dense line can hold what another file spreads over ten), but for "roughly how big is this function I'm about to paste into a review?" it answers instantly, without installing a cloc-style tool. For logs the total is usually the interesting number, since most log formats emit one event per line: paste an excerpt and the line count is the event count, minus any stack traces that wrap across lines. Everything runs in-browser on a static page, which matters precisely for this audience — logs and config snippets are the kind of text you should be reluctant to paste into a tool that uploads it.

Frequently asked questions

Does a trailing newline count as an extra line?

No. A newline at the very end of the text terminates the last line rather than opening an empty new one, so "a↵b↵" is 2 lines, not 3. This matches wc -l, POSIX's definition of a line, and what your editor's line numbers show for a file with a final newline.

How are Windows (CRLF) line endings handled?

CRLF pairs and lone carriage returns are each treated as a single line break before counting, so a file saved on Windows and the same file saved on Linux report identical line counts.

What counts as a blank line?

A line that is empty or contains only whitespace — spaces and tabs. A line holding even one visible character counts as non-empty. Total lines is always non-empty plus blank.

Is it safe to paste logs or config files here?

The counting is plain JavaScript running locally on a static page — nothing you paste is uploaded, logged, or stored, and the page keeps counting with your connection switched off. That said, the usual caution about pasting secrets anywhere still applies.

Counting happens locally in your browser — nothing you paste is transmitted or stored. For prose rather than code, the word counter, character counter, and paragraph counter are the right tools; the exact line rules live on the methodology page.