Duplicate Line Remover: Deduplicate and Sort Lines
Remove duplicate lines from a text list, with options for case sensitivity, whitespace trimming, and alphabetical sorting.
Cleaned Result
Paste your text list here... Apple Orange Apple (duplicate) Banana
Duplicate line remover
This tool splits a block of pasted text into individual lines and keeps only the unique ones, removing any line that repeats further down the list. Four separate toggles decide what counts as the same line: whether matching is case sensitive, whether whitespace is trimmed first, whether blank lines are dropped, and whether the result is sorted alphabetically or left in its original order.
How it works
The input is split at every line break, and each remaining line is compared to the ones already seen. With trim whitespace on, which is the default, leading and trailing spaces are cut from every line before comparison, so a line with a stray trailing space no longer counts as different from the same line without one. With remove empty lines on, also the default, blank lines left after trimming are dropped instead of being treated as one more duplicate of each other. Each line is then checked against a lowercase version of itself unless case sensitive is switched on, so "Ana" and "ANA" collapse into a single entry by default and only stay separate once case sensitivity is turned on. The first time a line appears it is kept; later repeats are dropped. Turning on sort alphabetically reorders the surviving lines from A to Z instead of keeping the order they were pasted in.
Worked example
Pasting this five-line list of contact emails, with trim whitespace and remove empty lines on and case sensitivity off, leaves three unique lines: ana@studiomail.com, ben@studiomail.com, and cole@studiomail.com. The result panel reports 5 total lines, 2 removed, and 3 remaining, because the fourth line was only a repeat of the second with a trailing space, and the third line matched the first once the capital letters were folded to lowercase. Turning case sensitivity on changes the outcome: "ANA@studiomail.com" is now treated as a separate line from "ana@studiomail.com", so 4 lines remain instead of 3, with only 1 removed.
Input:
ana@studiomail.com
ben@studiomail.com
ANA@studiomail.com
ben@studiomail.com
cole@studiomail.com
Output (case-insensitive, trimmed, empty lines removed):
ana@studiomail.com
ben@studiomail.com
cole@studiomail.com
With sort alphabetically also switched on, the same three lines come back as ana@studiomail.com, ben@studiomail.com, cole@studiomail.com, in alphabetical order rather than the order they were pasted in. The total, removed, and remaining counts update every time the list is processed, so the effect of each toggle is visible right away.