Skip to content
HexSlate

Remove Duplicate Lines

Your list0 B / 2 MB

Nothing to check yet

Paste a list into the box. Duplicates are found as you type.

lines 0 → 00 duplicate lines removedchecked in 0.2 ms

The order of your list is never changed

Lines come out in the order they went in. Most tools get this wrong because the easy way to find duplicates is to sort first and drop matching neighbours. Both Unix answers have the problem: sort -u returns a sorted list whether you wanted one or not, and uniq only removes duplicates that are already adjacent, so on an unsorted file it misses every repeat not next to its twin. This compares through a hash map, so order survives and distance does not matter.

Keep first or keep last

Keep-last holds the position of the final mention and moves the survivor down with it, which reorders the list relative to keep-first. In a log, an append-only export or a list someone kept correcting, the last entry is the current one.

It also decides which spelling survives when lines are not byte-identical. With Ignore case on, Apple and APPLE are one entry; keep-first writes Apple, keep-last writes APPLE. The surviving line is never rewritten.

What counts as the same line

Ignore case uses Unicode full case mapping, the same rules in every language, so É matches é but German ß does not match SS and Turkish dotless ı does not match i. Those need language-specific rules, and a dedupe result should not depend on who is looking.

Ignore surrounding whitespace trims each end only, so red apple with one space and with two stay separate. Blank lines are lines: repeated blanks collapse to one. Line endings are not compared, so CRLF and LF files dedupe identically.

Common problems

  • Nothing was removed but you can see repeats. The entries differ by an invisible character: a trailing space, a tab, a non-breaking space from a web page, a zero-width space. If trimming does not fix it, the difference is inside the line and the whitespace remover will name it.
  • Two identical-looking entries are not reported as duplicates.é can be one code point or an e plus a combining accent. Both render the same and compare as different. Not normalised here, since rewriting your data silently is worse than a miss you can see.

Frequently asked questions

Is my list uploaded anywhere?

No. Deduped lists tend to be email addresses, customer records and exported user data. Only the four settings go in the URL. The limit is 2 MB, roughly 60,000 to 100,000 lines.

Can it deduplicate on one column of a CSV?

No, it compares whole lines. Deduplicating by one column while keeping the rest of the row is a spreadsheet job: Data then Remove duplicates in Excel or Google Sheets lets you pick the columns.

Why does Excel have no keep-last option?

Excel's Remove Duplicates always keeps the first occurrence in the current sort order, so the workaround there is to sort backwards, dedupe, then sort back.

Does it change the order of my list?

No. Lines come back in the order they were written, with the repeats removed. Keep-first holds the original position; keep-last moves the survivor to where the final mention was, which is what you want when the later line is the corrected one.