Home/Calculators/Text Tools/Duplicate Line Remover

Duplicate Line Remover

Paste a list and keep only the unique lines, in their original order.

duplicate-line-remover
Result
—
In summary: A list of a, b, a, c returns 3 unique lines: a, b and c. The tool walks your text top to bottom, keeps the first time each line appears and drops every later repeat — so the original order survives, unlike an alphabetical sort-and-unique.

How duplicates are detected

Each line is trimmed of leading and trailing spaces, then compared exactly — the match is case-sensitive, so “Apple” and “apple” both survive. Empty lines are skipped entirely. The first occurrence is kept and the counter reports how many repeats were dropped: from a, b, a, c that is 3 kept, 1 removed.

Everything runs in your browser — the list you paste is never uploaded, transmitted or stored on a server, so you can safely de-duplicate customer emails or internal URLs.

If you want a different flavour of the same thing, try the word frequency counter.

Typical use cases

Cleaning email or keyword lists before an import, de-duplicating URLs from a crawl, tidying CSV columns pasted from a spreadsheet, and merging two lists into one. Because order is preserved, you can safely de-duplicate a ranked list without losing its ranking. Count what is left with the word counter.

A worked example: paste 1,200 exported subscriber emails, get 1,043 unique lines back and see that 157 repeats were dropped, before the import tool rejects the file. Watch for trailing commas or quotes copied from a spreadsheet — “apple,” and “apple” are different lines and both survive.

The random list picker covers the same ground with a different mechanism.

Order-preserving vs sorted output

Command-line sort | uniq requires sorting first, which destroys the original sequence. This tool uses a hash set instead, so it is a single pass and keeps sequence intact. If you then need the survivors on one line, feed them into remove line breaks.

Frequently asked questions

How many lines remain from a, b, a, c?
Three: a, b and c. The second “a” is removed as a duplicate.
Is the comparison case-sensitive?
Yes. “Apple” and “apple” are treated as two different lines.
Does it sort the output?
No. Lines are returned in their original order, with only later repeats removed.
What happens to blank lines?
They are ignored and never appear in the unique list.
Does it detect lines that differ only by trailing spaces or punctuation?
Leading and trailing spaces are trimmed before comparison, so “apple ” and “apple” are treated as the same line. Any other difference, including a trailing comma or a quotation mark from a spreadsheet, counts as a different line.
How this tool works

The formula behind this tool is written out in full in the sections above, so you can check the maths yourself. Every calculator on Calculorium is verified against worked examples with automated tests before it is published, and pages are reviewed as formulas or standards change. Nothing you type is sent anywhere — the calculation runs entirely in your browser. Read how we build and check these tools.

Last updated: October 2, 2026 · Calculations run in your browser. Estimates for information only.