Line Counter
Count lines in your text and clean them up — remove blank lines, drop duplicates, and trim trailing spaces.
ToolsSoup's Line Counter is a free online tool that counts the lines in your text the moment you type or paste it, and lets you clean those lines up with one click. See total, non-empty, unique, and blank line counts live, then remove blank lines, drop duplicate lines, or trim trailing spaces and copy the cleaned result. Everything runs in your browser — no uploads, no sign-up, and your text never leaves your device.
What is a line counter?
A line counter is a tool that tells you how many lines are in a block of text. A line is any run of characters ending at a line break, so a list, a log file, a CSV, or a code snippet each break into one line per row. This counter goes further than a single number: it separates the total line count from the non-empty count, the count of unique lines, and the number of blank lines, so you can see the real shape of your text at a glance. It also doubles as a quick line editor for the most common cleanup tasks.
How to count lines online
Counting lines with ToolsSoup takes just a few seconds:
- Type directly into the text box or paste a list, log, or any multi-line text.
- Watch the total, non-empty, unique, and blank line counts update live as you edit.
- Optionally clean the lines — remove blank lines, remove duplicate lines, or trim trailing spaces — then click Copy result to grab the cleaned text.
How are lines counted?
Each line break starts a new line, and line breaks from Windows, macOS, and Unix files are all recognized, so pasted text counts the same no matter where it came from. Empty input counts as zero lines. The non-empty figure ignores lines that contain only spaces or tabs, the unique figure counts each distinct line once, and the blank figure is simply the total minus the non-empty lines. Removing blank lines deletes the whitespace-only rows, removing duplicate lines keeps only the first occurrence of each line, and trimming trailing spaces strips spaces and tabs from the end of every line.
Why use this line counter?
- Live total, non-empty, unique, and blank line counts as you type.
- One-click line cleanup: remove blank lines, remove duplicate lines, and trim trailing spaces.
- Handles Windows, macOS, and Unix line endings the same way.
- Runs entirely in your browser — your text is never uploaded to a server.
- 100% free with no ads, sign-up, or usage limits, and the cleaned result copies in one click.
Frequently asked questions
How do I count the number of lines in my text?
Paste or type your text into the box and the total line count appears instantly, alongside the number of non-empty, unique, and blank lines. There is no button to press — the counts update live as you edit.
What counts as a blank line?
A blank line is one that is empty or contains only spaces or tabs. The blank count is the total number of lines minus the non-empty lines, and Remove blank lines deletes exactly those whitespace-only rows.
How do I remove duplicate lines?
Click Remove duplicate lines and the tool keeps only the first occurrence of each line, dropping any later repeats while preserving the original order. The cleaned text appears in the result box ready to copy.
Does it handle Windows and Unix line endings?
Yes. Carriage-return, line-feed, and combined Windows line breaks are all treated as line boundaries, so the count is the same whether your text came from Windows, macOS, or Linux.
Is my text private?
Absolutely. All counting and cleanup happens locally in your browser using JavaScript, so the text you enter is never sent to or stored on any server.