Skip to content
Devtoolry

Remove Duplicate Lines

Remove duplicate lines from text online, keeping the first occurrence and the original order. Optionally ignore case, extra spaces and empty lines.

Something not working, or missing a feature? Send feedback

About the Remove Duplicate Lines

The Remove Duplicate Lines tool deletes repeated lines from a list and keeps the first occurrence of each, in the original order. It is useful for cleaning up email lists, log extracts, CSV columns, keyword lists and configuration entries without opening a spreadsheet or writing a script.

Everything runs in your browser, so your input is never uploaded to a server.

How to use the Remove Duplicate Lines

  1. Paste your text, one item per line.
  2. Choose whether "Ada" and "ada" count as the same line, and whether to ignore surrounding spaces.
  3. Optionally remove empty lines, then copy or download the cleaned list. The summary shows how many lines were removed.

Examples

Clean an email list

Input

[email protected]
[email protected]
[email protected]
 [email protected]
[email protected]

[email protected]

Result

[email protected]
[email protected]
 [email protected]

[email protected] matches [email protected] because the comparison ignores case, and the last [email protected] matches the indented one because surrounding spaces are ignored. The first copy is kept exactly as written.

Case-sensitive deduplication of log lines

Input

ERROR timeout
WARN slow
ERROR timeout
error timeout

Result

ERROR timeout
WARN slow
error timeout

With case sensitivity on, "error timeout" is kept as a different line from "ERROR timeout".

Common mistakes

  • Expecting a sorted result. Removing duplicates keeps the original order. Use Sort Lines with "Remove duplicates" on if you want a sorted, unique list.
  • Invisible differences. Lines that look the same can differ by a tab, a non-breaking space or a trailing carriage return. Keep "Ignore surrounding spaces" on, and check suspicious lines with the Unicode Escape tool.

Works well with the Remove Duplicate Lines

Frequently asked questions

Which copy of a duplicate is kept?

The first one. Later copies are removed and the remaining lines stay in their original order, so nothing is re-sorted.

Does "Ignore surrounding spaces" change my lines?

No. Spaces at the start and end are ignored only when comparing; the line that is kept is written exactly as it was.

Is there a size limit?

No fixed limit: everything runs in your browser, so lists with hundreds of thousands of lines work on a typical computer.