Skip to main content
SwiftTools

Line Counter

Free line counter. Count total, non-empty, clean and trailing-whitespace lines in any text instantly.

Total lines
0
Non-empty lines
0
Clean (trimmed) lines
0
Trailing whitespace
0
lines ending in spaces

About Line Counter

Count the lines in any text instantly - total lines, non-empty lines, clean trimmed lines, and lines that end in stray spaces. Useful for cleaning logs, CSVs, and lists where the line count matters.

How to use it

  1. 1Type or paste your text into the box.
  2. 2Watch the four line counts update as you type.
  3. 3Use Clear to start over.

When to use it

  • Cleaning a CSV or log where you need to know exactly how many rows you have before importing it.
  • Checking a draft has the paragraph and line structure a formatter expects.
  • Auditing a list for stray blank or trailing-whitespace lines that break downstream tools.

Tips & best practices

  • Count non-empty lines when you care about real content; count total lines when you care about structure.
  • Trim trailing whitespace across a file before a diff so blank-ish lines do not create noise.
  • A blank line in the middle is usually intentional; a trailing blank line at the end is often accidental.

Examples

A short list

Input
apple
banana

cherry
Result
4 total lines · 3 non-empty · 2 clean · 0 trailing

A trimmed paragraph

Input
one
two
three
Result
3 total lines · 3 non-empty · 3 clean

Frequently asked questions

What is the difference between total and non-empty lines?

Total counts every line including blanks; non-empty counts only lines with visible text.

Why count trimmed lines?

A line with only spaces is visually blank. Trimmed lines are those that have no leading or trailing spaces, which helps spot inconsistent formatting.

Why do two tools report different line counts for the same text?

They may or may not count a final trailing newline, and they treat whitespace-only lines differently. Decide which definition you need before trusting the number.

Does it count line breaks inside a single paragraph?

It counts physical line breaks (newline characters), not logical paragraphs. Soft line wraps in the display do not count as new lines.