Paste text to see total lines, non-empty lines, words, and characters. Then sort, remove duplicate lines, or delete blank lines.
This tool runs entirely in your browser. What you enter is never sent anywhere.Your input is never sent anywhere.
DetailsResults
💡 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
- Paste or type your text into the editor.
- Read the Results panel. Counts update as you type.
- 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.
| Count | How it is counted | Good for |
|---|---|---|
| Total lines | Every line separated by a line break, including blank lines | Checking the raw size of a file, log, or pasted column |
| Non-empty lines | Lines left after removing those that are empty or whitespace-only | Counting list items, records, or lines of code |
| Characters (with spaces) | Every character in the text, including spaces and line breaks | Length limits for forms, captions, and fields |
| Characters (no spaces) | All characters except spaces, tabs, and line breaks | Comparing text length without formatting |
| Words | Runs of text separated by spaces, tabs, or line breaks | Quick 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▼
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▼
Numbers sort as 1, 10, 2
Sort A–Z compares lines as text, not as numbers, so 10 lands before 2.
💡 See the solution▼
Questions About Counting, Sorting, and Duplicates
Q.How do I count the lines in a block of text?
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?
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?
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?
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?
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?
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?
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?
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.
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.