Back

Duplicate line remover

Text tools

Loading

Loading tool

Preparing the tool. The remaining time is not yet known.

All processing for this tool happens in your browser. Your input is not sent to a server.

About this tool

Remove duplicate lines while retaining the first or last occurrence in source order.

Common uses

  • Remove duplicate lines while retaining the first or last occurrence in source order.
  • Choose trimming, case-insensitive comparison and blank-line removal before deduplicating.

How to use it

  1. 1.Choose trimming, case-insensitive comparison and blank-line removal before deduplicating.
  2. 2.Select first or last occurrence retention and copy the remaining lines with the reported count.

Worked example

Input and result

a
b
a (keep last)
b
a

Keeping last occurrences preserves their relative order.

Limits and notes

  • Trimming changes the output text as well as comparison keys. Keeping the last occurrence preserves the relative order of those last occurrences; it does not sort the lines.

Frequently asked questions

What does this tool do?

Remove duplicate lines while retaining the first or last occurrence in source order.

What should I check before using the result?

Trimming changes the output text as well as comparison keys. Keeping the last occurrence preserves the relative order of those last occurrences; it does not sort the lines.

Related tools