Pular para o conteúdo
Tool

Line Counter

Count the number of lines in your text, code or list and remove empty lines automatically.

What it is

The Line Counter counts the lines in a block of text or code, numbers them, and can remove the blank ones.

Where a line count is the unit that matters

Plenty of work is measured in lines rather than words. A list of emails or product codes, one per line, where the count is how many records you have. A code file, where a review or an estimate is quoted in lines. A CSV, where the line count minus the header is the row count. A subtitle file, where each line is a caption.

In all of those, opening a word processor to find out gives you the wrong number.

How to use it

  1. Paste the text or the code.
  2. Read the counts: total lines, non-empty lines, and how many were blank.
  3. Clean up if you need to, removing blank lines and copying the result.

Why two counts

Total and non-empty differ more than people expect, and which one you want depends on the job.

A list of records pasted from a spreadsheet often carries a trailing newline, so the total is one higher than the number of records. Code files use blank lines for readability, so a file with 400 total lines might hold 320 lines of actual code. Text copied from a PDF often has a blank line between every paragraph, doubling the total.

Counting both is the point: the difference between them tells you what you are actually holding.

Everything runs in your browser and nothing you paste is sent anywhere. Related: the character counter and the duplicate line remover.

Frequently asked questions

Why is the total different from the non-empty count?

Because blank lines are counted in the total and not in the other. A file with 400 lines might hold 320 lines of actual content, and text copied from a PDF often has a blank line between every paragraph.

My list shows one more line than I have records. Why?

A trailing newline at the end of the text. Most editors and spreadsheets add one, and it counts as a line even though it holds nothing.

Can it remove the blank lines?

Yes. Clean them out and copy the result, which is the quick way to tidy a list pasted from a PDF or an email.

Does it count lines of code correctly?

It counts every line, including the blank ones used for readability, and reports both totals separately. For a code file the non-empty count is usually the number people mean by lines of code.

About this content

Written by:
Ferramenta Grátis

Related tools