Line CounterCount Lines, Words & Characters Online

Paste text to see total lines, non-empty lines, words, and characters. Then sort, remove duplicate lines, or delete blank lines.

Your input is never sent anywhere.

Details
Total lines0
Characters0
Editor

Results

Total lines
0lines
Every line, including empty ones
Non-empty lines
0lines
Skips blank and whitespace-only lines
Characters (with spaces)
0chars
Characters (no spaces)
0chars
Words
0words
Split on spaces and line breaks

💡 Tip: Non-empty lines ignores blank lines, so it gives the true item count for a list.

How This Line Counter Works

Paste any text and the counts update as you type: total lines, non-empty lines, words, and characters with and without spaces. Total lines includes blank lines. Non-empty lines leaves out lines that are empty or contain only spaces or tabs. Three buttons edit the text in place: sort A–Z, remove duplicate lines, and remove empty lines.

Lists, Logs, Scripts, and Line Limits

Cleaning up a list

Paste a column of email addresses, names, or SKUs, remove duplicates, and read Non-empty lines for the number of unique entries.

Sizing a script or log

Get a quick line total for a code snippet or log excerpt. Blank lines are separated out, but comment lines are still counted.

Writing to a line limit

Check poems, captions, subtitles, or scripts against a required number of lines while keeping an eye on word and character counts.

Alphabetizing a list

Sort lines A–Z, then copy the result back into your spreadsheet, document, or config file.

Count and Clean Up Text in 3 Steps

  1. Paste or type your text into the editor.
  2. Read the Results panel. Counts update as you type.
  3. Click Sort A–Z, Remove duplicates, or Remove empty lines if needed, then use Copy text.

Note: Non-empty lines skips lines that are empty or contain only spaces or tabs.

Counting Rules and Limits

  • Each line break starts a new line. Windows (CRLF) and Unix (LF) line breaks both count once.
  • A line break at the end of your text adds one empty line to Total lines. Non-empty lines is not affected.
  • Characters are counted as your browser counts them, so some emoji and rare symbols count as two.
  • Edits change the text in the editor and there is no undo button. Copy your original text first if you want to keep it.
  • Everything runs in your browser. Very large pastes depend on your device's memory.

What Each Count Measures

Definitions match how the tool calculates each number.

CountHow it is countedGood for
Total linesEvery line separated by a line break, including blank linesChecking the raw size of a file, log, or pasted column
Non-empty linesLines left after removing those that are empty or whitespace-onlyCounting list items, records, or lines of code
Characters (with spaces)Every character in the text, including spaces and line breaksLength limits for forms, captions, and fields
Characters (no spaces)All characters except spaces, tabs, and line breaksComparing text length without formatting
WordsRuns of text separated by spaces, tabs, or line breaksQuick word totals for drafts and notes

To get the number of unique entries in a list, click Remove duplicates first, then read Non-empty lines.

Why the Count Might Look Off

The total is one higher than expected

Your text ends with a line break, which the tool counts as an extra empty line at the end.

💡 See the solution▼
Read Non-empty lines instead, or click Remove empty lines to delete the blank line from the text.

Duplicate lines are still there after Remove duplicates

Lines must match exactly. A different capital letter or a trailing space makes two lines count as different.

💡 See the solution▼
Make the entries consistent in your source first (same case, no stray spaces), then run Remove duplicates again.

Numbers sort as 1, 10, 2

Sort A–Z compares lines as text, not as numbers, so 10 lands before 2.

💡 See the solution▼
Add leading zeros so every number has the same length (02, 10), then sort.

Questions About Counting, Sorting, and Duplicates

Q.How do I count the lines in a block of text?

Q.

A. Paste or type your text into the editor. Total lines, non-empty lines, words, and characters update as you type, so there is no button to press.

Q.What is the difference between total lines and non-empty lines?

Q.

A. Total lines counts every line separated by a line break, including blank ones. Non-empty lines skips any line that is empty or contains only spaces or tabs. A line break at the very end of your text adds one empty line to the total.

Q.How do I count lines without the blank ones?

Q.

A. Read the Non-empty lines number. If you also want the blank lines gone from the text itself, click Remove empty lines. It deletes lines that are empty or hold only whitespace.

Q.How does Remove duplicates decide that two lines match?

Q.

A. Lines must match character for character. "Apple" and "apple" are different, and so are "apple" and "apple " with a trailing space. The first occurrence of each line stays in its original position, and later copies are removed. Blank lines count too, so several blank lines collapse into one.

Q.How does Sort A–Z order my lines?

Q.

A. It sorts lines in ascending order using English alphabetical rules. Numbers are compared as text, so 10 comes before 2. Add leading zeros (02, 10) if you need numeric order. There is no descending sort.

Q.How are words counted?

Q.

A. Words are runs of characters separated by spaces, tabs, or line breaks. A hyphenated term like "well-known" counts as one word, and text written without spaces counts as one word for each unbroken run.

Q.Is my text uploaded or saved anywhere?

Q.

A. No. The counting and editing run in your browser, and the tool does not send your text to a server or store it. Closing or refreshing the page clears the editor.

Q.Can I use it to count lines of code?

Q.

A. Yes, with one caveat. Non-empty lines excludes blank lines but not comments, so a comment line counts the same as a line of code. Subtract comment lines yourself if you need code-only totals.

User Feedback & Request

Your feedback
makes this tool better.

Tell us which features you'd like, what should be fixed, or which new tool you'd like to see. An engineer reads every submission and uses it to guide development.

Send feedback