Remove Duplicate Lines

Remove duplicate lines from text.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Paste a list with one item per line and press Run. Every line that already appeared above it is removed, and the first occurrence stays in its original position.

How to use

1
Step 1
Paste your list, one item per line, into Input.
2
Step 2
Press Run.
3
Step 3
Copy the de-duplicated list from Output.

How it works

Lines are compared exactly as typed. Apple and apple are different, and so are two lines that differ only by a trailing space. The first copy is kept, so the order of the list is preserved. Blank lines are also treated as lines, so only the first blank line survives.

Worked example

A mailing list with repeats

Input
apple banana apple Cherry banana Apple
Output
apple banana Cherry Apple
Walkthrough
The second apple and second banana are removed. Apple with a capital A is a different line, so it stays.

Limitations

  • Case-sensitive and whitespace-sensitive: normalise case or trim first if you want a looser match.
  • Does not sort the list.
  • Compares whole lines only, not words inside a line.

Questions

How do I remove duplicate lines?
Paste the list into Input and press Run. Repeats are dropped and the first copy of each line stays.
Is the comparison case-sensitive?
Yes. Apple and apple count as different lines.
Why was a near-duplicate not removed?
A trailing space or different capital makes the lines unequal. Run Trim Whitespace or Lowercase Converter first.
Does it change the order?
No. The first occurrences keep their order.

Features

  • Keeps first occurrence
  • Preserves order
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • HTML Crash Course For Absolute Beginners

    Traversy Media

    Text on the web often starts as HTML you clean or count.

    Watch on YouTube
  • HTML in 100 Seconds

    Fireship

    Quick HTML mental model next to text transform tools.

    Watch on YouTube