Remove Duplicate Lines
Keep the first copy of each line, with optional trimming, blank-line removal and sorting.
Input & settings
Results
What this tool does
Remove Duplicate Lines splits the text on line breaks and keeps the first copy of each line. Later copies are dropped. You can trim spaces before comparing, skip blank lines, ignore letter case, and sort the remaining lines. Without sorting, the original order of the first occurrences is kept.
How to use it
- Paste the lines.
- Choose trim, blank-line, case and sort options.
- Remove duplicates, then copy or download the result.
Practical example
The lines Apple, apple and Apple, with case ignored, become one line: Apple. With case respected, Apple and apple both remain.
Tips
Trimming changes the line that is kept, not only the comparison. Sorting uses the browser’s locale order and treats numbers numerically. The text is not uploaded.
Questions
Which duplicate is kept?
The first occurrence, unless you turn on sorting, which reorders the kept lines.
Does ignore case change the kept text?
The comparison ignores case. The kept text is still the first line as it appeared after optional trimming.
Are blank lines duplicates?
Blank lines can be removed with the empty-line option. Without that option, the first blank line is kept and later blank lines are duplicates.
What line endings are accepted?
Windows and Unix line breaks are both split into lines.
Is the text saved?
No. Clear the boxes when you finish on a shared computer.