Skip to content

Line Counter

Count total and non-empty lines in text, logs, CSV or code.

Runs in your browserNo account neededFree
Loading tool…

Processing: This tool runs entirely in your browser. Your input and any file you open stay on your device — nothing is uploaded to a server.

How to use the line counter

  1. Paste or type your text.
  2. The counts update as you type.
  3. Read the highlighted figure, or any of the others below.

About this tool

Lines are split on any of the three line-ending conventions — Unix \n, Windows \r\n and old Mac \r — so text from any platform counts correctly rather than collapsing into one long line.

Both totals are shown because they answer different questions. Total lines matters when you are matching an editor's line numbers or a stack trace. Non-empty lines matters when you are counting actual records, such as rows in a pasted CSV or entries in a log.

A file's final line is the usual source of an off-by-one. A trailing newline at the end of a file is conventional on Unix and means the last line is empty; whether your editor shows that as an extra line depends on the editor, not on the file.

Common uses

  • Counting records in a pasted CSV or log.
  • Checking a file against a line limit.
  • Matching a line number from an error message.

Frequently asked questions

What is the difference between total and non-empty lines?
Total counts every line including blank ones. Non-empty skips blanks, which is what you want when counting records rather than matching line numbers.
Does it handle Windows line endings?
Yes. It splits on \n, \r\n and \r, so text from any platform counts correctly.
Why is my count one more than my editor shows?
A trailing newline at the end of the text creates a final empty line. Editors differ on whether they display it.

Related tools