HandyBench

Remove Duplicate Lines

Deduplicate any list, with optional sort.

How to use the Remove Duplicate Lines

  1. 1 Paste your list, one item per line.
  2. 2 Toggle ignore case, trim lines and sorting as needed.
  3. 3 Copy the de-duplicated list.

How duplicates are detected

The text is split on line breaks, and each line is compared against a set of lines already seen. The first time a line appears it is kept, and every later copy is dropped, so the original order survives. Two checkboxes change what "the same" means.

  • Trim lines (on by default): leading and trailing spaces are removed before comparing, and the cleaned version is what ends up in the output. apple and  apple are therefore one line.
  • Ignore case (off by default): the comparison key is lower-cased, so Apple and APPLE match. The line that survives keeps the capitalisation of its first appearance.
  • Sort A-Z: after removing duplicates the survivors are sorted with the browser's locale-aware comparison. Leave it off to keep your original sequence.

Worked example

Input of eight lines: apple, Banana,  apple (leading space), APPLE, an empty line, cherry, another empty line, banana.

SettingsOutputRemoved
Trim on, ignore case offapple, Banana, APPLE, (empty), cherry, banana2
Trim on, ignore case onapple, Banana, (empty), cherry4

The only difference between the rows is the case setting, which is why a list that "should" collapse sometimes does not: with case sensitivity on, APPLE and banana survive as separate entries.

Things to watch for

  • Blank lines are lines too. The first empty line is kept as a normal entry and every later one is removed as a duplicate. If you want no blanks at all, use the sort tool, which has a "Remove empty lines" option.
  • Whole lines only. The match is on the entire line. apple pie and apple are different lines, and the tool never deduplicates words inside a line.
  • Trim off means exact. A trailing space or tab makes two visually identical lines different. If a deduplication seems to miss obvious copies, switch trimming on or clean the text first with Text Cleaner.
  • Accents count as different. café and cafe are distinct, because the comparison only changes case.

The counters above the output show unique lines and the number removed, which makes it easy to confirm that, for example, a 5,000-address list lost the number of repeats you expected. For ordering the survivors afterwards, Sort Lines offers numeric and reverse options as well.

Examples

  • ▸ "apple, Banana, apple, APPLE, banana" on separate lines → with ignore case on: apple, Banana.
  • ▸ A pasted list of 5,000 email addresses → the unique count and the number of duplicates removed appear above the result.

Frequently asked questions

Does it keep the original order?

By default the first occurrence of each line is kept in its original position. You can also sort the output alphabetically.

Can it ignore upper/lowercase differences?

Yes. Enable "ignore case" to treat "Apple" and "apple" as the same line. The copy that is kept has the capitalization of its first appearance.

Why are lines with extra spaces counted as duplicates?

"Trim lines" is on by default, so leading and trailing spaces are removed before lines are compared and the trimmed version is what appears in the output. Untick it if a trailing space should make two lines different.

What happens to blank lines?

Blank lines are treated like any other line: the first empty line is kept and later ones are removed as duplicates. To remove blank lines completely, use Sort Lines with "Remove empty lines" ticked.

Does it remove duplicate words inside a line?

No. It compares whole lines only, so "apple pie" and "apple" are different. Put each item on its own line first if you want to deduplicate individual words.