Line Counter - DigiKitApp

Count total and non-empty lines in a text.

When should you use this?

Use this when you need a quick line count in a text, inspecting a log file or a list, for example.

When shouldn't you use this?

Don't interpret the result without checking whether blank lines are counted too; in some cases (a CSV row count, say) blank lines need to be handled differently.

Step-by-step

  1. Paste the content into the Text field. It can be log output, a mailing list, the contents of a CSV file or a poem you are formatting.
  2. Glance at the end of the text for stray empty lines, since they are added to the total.
  3. Click Run.
  4. You get two numbers: total lines and non-empty lines, meaning lines with at least one character on them. Use whichever matches the question you are answering.

Example

You copied an attendee list out of a spreadsheet, and the first row holds the column headers. If the non-empty count comes back as 121, you have 120 attendees once the header is removed. If the total is higher than that, the gap is made up of blank lines somewhere in or after the list. That gap is a useful prompt to scroll through and check whether a record was skipped or left empty when the data was copied.

Total lines and non-empty lines

The tool splits the text at line breaks (Windows and Mac/Linux styles included) and gives two numbers: total lines and non-empty lines. A non-empty line has at least one character other than whitespace; lines of only spaces or tabs count as empty. Example: a text with “a”, a blank line, “b” and a final line break gives 4 total and 2 non-empty lines, because the empty piece after the last line break also counts as a line. With no text the result is 0 and 0.

When counting lines

  • An extra line break at the end of the text adds 1 to the total. The non-empty count is unaffected, so use it to measure the real content.
  • A line here means one started with Enter, not a line as displayed on screen. A long paragraph that wraps over several screen lines is still one line.
  • For code, lists or CSV files, the non-empty count is usually the more reliable way to find the number of records. Remember to subtract a header row if there is one.
  • The tool only counts; to remove blank lines use the text cleaner.

Things to keep in mind

  • A line holding only spaces or a tab looks empty but may be counted as non-empty. If the numbers seem off, invisible whitespace is a common reason.
  • In a CSV, a quoted cell can contain line breaks. When that happens the line count and the record count stop matching.
  • Spreadsheet cells with multi-line content cause the same mismatch after copying, so compare against the row numbers in the sheet itself.
  • For source code, line count is a rough sense of size only. It includes comments and blank lines and says nothing about quality.

Frequently asked questions

Is my data stored?

No, none of the data you enter is sent to a server or stored.

Is this tool free?

Yes, completely free and no account required.

How long does it take to get a result?

Most operations complete instantly; larger files may take a few seconds.