Remove Duplicate Lines
Remove duplicate lines from a list in your browser. Ignore case or extra spaces, keep the first or last copy, and sort the result. Nothing is uploaded.
0 characters
Runs in your browser. Nothing you enter is uploaded.
How to use
This tool removes repeated lines from a list, so each line appears only once.
- Paste your list into Your lines, one item per line, or open a text file. The cleaned list appears next to it as you type, with a count of how many lines were removed.
- Choose how lines are compared:
- Ignore case treats "Apple" and "apple" as the same line.
- Trim spaces ignores spaces and tabs at the start and end of each line, and removes them from the result too.
- Remove empty lines drops blank lines. When it is off, blank lines stay where they are, so gaps between groups survive.
- Under Keep, pick whether the first or the last copy of each repeated line stays. The kept lines stay in their original order.
- Under Sort, keep the original order or sort A to Z, Z to A, or shortest first. Sorting is natural, so "item 2" comes before "item 10".
- Press Copy or Download .txt to use the result.
Open Most repeated lines to see which lines appeared most often and how many times. It is a quick way to spot the biggest offenders in a mailing list or log file.
Lines that look the same are treated as the same, even if an accented letter is stored differently underneath. Windows and Mac line endings are read too; the result uses plain line breaks, which every editor reads.
Long lists of hundreds of thousands of lines work too. They're processed in the background, though showing a very long result can take the page a few seconds. Your settings are remembered on this device; your text is not.
Frequently asked questions
Does removing duplicates change the order of my lines?
No. With Sort set to Original order, the remaining lines stay in the order they appeared. Only the extra copies are removed.
Can I remove duplicate email addresses that differ only in capitals?
Yes. Turn on Ignore case and Trim spaces, and "Name@Example.com " and "name@example.com" count as the same line. The first copy is kept as it was written.
Is there a limit to how many lines I can clean?
There is no fixed limit. Very large lists are processed in the background, though showing a result of hundreds of thousands of lines can take the page a few seconds. Nothing is sent to a server.
Related tools
More text tools
- Slug generator Turn titles into clean URL slugs.
- Regex tester Test JavaScript regular expressions with matches highlighted as you type.