Remove Duplicate Lines
Remove duplicate lines from text.
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
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?
Is the comparison case-sensitive?
Why was a near-duplicate not removed?
Does it change the 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 YouTubeHTML in 100 Seconds
Fireship
Quick HTML mental model next to text transform tools.
Watch on YouTube
- Unicode Normalization Forms
Unicode
Why seemingly identical characters break equality checks.
- Accessibility
MDN
Readable text and case choices matter for inclusive copy.