Skip to main content
Free Free Tool

Line Counter

Count lines, words, characters, and non-empty lines in any text.

  • Free · no sign-up
  • Instant results
  • Privacy-friendly

Other Text Utilities

Lines, non-empty lines, words and characters

Paste any text and you get four counts at once. The distinction that matters most is between total lines and non-empty lines, because they answer different questions: total lines tells you how long the block is, while non-empty lines tells you how many actual entries it contains.

That difference is the whole point when you are working with lists. A pasted column of email addresses or SKUs separated by blank lines has a total line count that overstates the number of records — and it is the record count you almost always need.

Why line counts disagree between tools

Two different conventions cause most of the confusion. The first is whether a trailing newline creates a final empty line. Text ending with a line break can reasonably be read as either three lines or four, and different tools choose differently — which is why a file may show 100 lines in one place and 101 in another.

The second is line endings themselves. Windows terminates lines with a carriage return plus a line feed, while Unix, Linux and macOS use a line feed alone. Text moved between systems can end up with mixed or doubled endings, producing phantom blank lines that appear real to a counter and invisible to the eye. If a count looks inexplicably high, mismatched line endings are the usual culprit.

What people actually use this for

The common cases are all verification tasks, where the count is a check on something else:

  • Confirming a data export is complete — the report said 1,240 rows, so the pasted list should have 1,240 non-empty lines.
  • Checking a CSV before import, where a mismatch between expected and actual lines usually means an unescaped line break inside a quoted field.
  • Counting lines of code in a snippet, or checking a file against a length limit in a review guideline.
  • Verifying a mailing or subscriber list before an upload that charges per record.
  • Checking log excerpts for how many events a filter actually matched.

The CSV caveat worth knowing

A line count is not a record count in CSV, and assuming otherwise causes real data loss. The format permits a line break inside a quoted field, so a single record containing a multi-line address legitimately spans several lines in the file.

If your line count exceeds the row count your spreadsheet or database reports, that is usually the explanation rather than duplicate data — and stripping the extra lines to make the numbers agree would corrupt the records. Remember the header row too: 1,001 lines is typically 1,000 records plus a header.

Characters, bytes and why limits are strange

The character count here counts characters, not bytes. For plain English the two match, but any character outside basic ASCII takes more than one byte in UTF-8 — accented letters take two, most CJK characters three, and emoji four or more.

This is why a message can be rejected as too long by a system whose limit is expressed in bytes even though your character count looks fine. Some emoji are also composed of several code points joined together, so a single visible symbol can register as more than one character depending on how it is counted.

Frequently asked questions

Why does my line count differ from my text editor? #
Usually the trailing newline. Text ending with a line break can be read as having a final empty line or not, and tools differ. Mixed Windows and Unix line endings are the other common cause, creating blank lines that are invisible on screen.
What is the difference between lines and non-empty lines? #
Total lines counts every line including blank ones; non-empty lines counts only those with content. For lists and data, non-empty lines is almost always the number you actually want, since blank separators inflate the total.
Why does my line count not match my CSV row count? #
CSV allows line breaks inside quoted fields, so one record containing a multi-line address spans several lines in the file. Do not remove the extra lines to make the numbers agree — that would corrupt the records. Remember the header row counts as a line too.
Is the character count the same as bytes? #
No. It counts characters. In UTF-8, accented letters take two bytes, most CJK characters three, and emoji four or more, which is why text can exceed a byte-based limit while looking well within a character limit.
How are words counted? #
By splitting on whitespace, so hyphenated words and numbers each count as one. It matches how word processors count, though results differ slightly for text heavy in punctuation or symbols.
Is my text stored? #
No. It is used to compute the counts for the response and is not written to disk or kept afterwards.