EthicalFusion

Line Counter

Count the total lines and characters in any block of text.

Was this tool helpful?

Thanks for the feedback!

The Line Counter tells you how many lines a block of text contains, alongside its character and word totals. Paste a list, a poem, a CSV export, a log file or a chunk of code, press Count lines, and read the figure in the Lines card under the result.

What counts as a line

A line is whatever sits between two line breaks, the points where someone pressed Enter. The count is simply the number of line breaks plus one, which leads to three rules worth knowing:

  • Blank lines are counted. An empty line between two stanzas or paragraphs adds one to the total.
  • A line break at the very end adds a line. Many files and copied lists end with a final Enter, which creates an empty last line.
  • Wrapped text is not split. A long paragraph that wraps across several rows on screen is still one line, because there is no line break inside it.

An empty box shows 1 line, since even blank text has one (empty) line.

Worked example: a short poem

Roses are red
Violets are blue

Sugar is sweet

With a blank line after the second line and a final Enter after "Sugar is sweet", the counter shows 5 lines, 47 characters, 37 without spaces and 9 words. Three lines hold text, one is the blank line between stanzas and one is the empty line created by the final Enter.

Getting the number you actually want

Only lines with text

Run the text through Remove Empty Lines first, then count. This is the right approach for word lists, email lists and most "how many items" questions.

Rows in a CSV file

A CSV export with a header row and two records, ending in a line break, reads as 4 lines: one header, two data rows and the empty last line. Subtract the header and any trailing empty line to get the number of records. Be careful with CSV fields that contain line breaks inside quotes, such as multi-line addresses, because each of those adds extra lines without adding records.

Unique lines

If the list may contain repeats, the duplicate line remover reports lines in, lines out and duplicates removed in one step, which doubles as a unique-line count.

Where line counts matter

  • Poetry competitions and journals that cap submissions at a set number of lines. Rules differ on whether stanza breaks count, so check the total with and without blank lines.
  • Code, when estimating the size of a file or a snippet for review. Remember that blank lines and comment lines are included here.
  • Data checks, such as confirming that 500 roll numbers were pasted before uploading them, or that an export has the expected number of rows.
  • Lyrics and subtitles, where each line maps to a display slot.

The other three numbers

The main result reads "N characters" because the counter reports characters, characters without spaces and words at the same time as lines. Line breaks are counted as characters in the first figure and excluded from the no-spaces figure. For a character limit on a social post, the character counter page explains how emoji and Indian scripts affect that total.

Frequently asked questions

How do I count the number of lines in text?
Paste the text and press Count lines. The Lines card shows the total, counting every line break plus one.
Does the line counter include blank lines?
Yes, empty lines are counted. Remove empty lines first if you only want lines that contain text.
Why is my line count one more than expected?
Your text probably ends with a line break, which creates an empty final line. Delete it and count again.
Does a long wrapped paragraph count as several lines?
No. Wrapping on screen does not create line breaks, so a paragraph without Enter presses counts as a single line.
How do I count rows in a CSV file?
Paste the CSV and read the Lines figure, then subtract the header row and any empty last line. Quoted fields containing line breaks will add extra lines.

Related tools

Embed this tool on your site

Paste it into any blog or website. Free, with a credit link.