b2KIT

Line Counter

Count total lines, blank lines, and non-blank lines in pasted text or code with line length statistics.

Tested tool guide Text and writing tools Checked July 30, 2026

What Line Counter does, with a checked example

The line counter treats every newline as a boundary, including blank lines. It reports total, blank, and non-blank lines plus characters, words, average non-blank line length, and the longest line. A distribution reveals how many lines fall into common width bands.

Worked example

A concrete input and expected output from the current implementation.

Input

alpha

beta gamma

Expected output

3 total lines, 2 non-blank lines, 1 blank line

The empty row between alpha and beta gamma is a real blank line. The longest line contains ten characters including the internal space.

How the result is produced

1

A trailing newline creates another line

Splitting text on newline characters means a final newline leaves an empty final entry. This matches many editor and file-format interpretations of a terminated line.

2

Widths count string code units

The current line-length statistics use JavaScript string length. Combined emoji and some non-BMP characters can therefore occupy more than one counted unit.

Good uses

  • Check code or data copied from a fixed-width format.
  • Find blank rows in a simple text export.
  • Locate lines longer than 80 or 120 characters.

Limits and checks

  • Windows CRLF input may retain carriage-return effects in copied text.
  • Tabs count as one character but can occupy several visual columns.
  • A line count does not determine the number of logical records in quoted data.

Common questions

Why does an empty final row count?

A newline is a separator. When text ends with one, there is an empty segment after the final separator.

Are wrapped screen lines included?

No. Visual wrapping depends on window width and styling. The tool counts explicit newline characters only.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools