How to use the Remove Duplicate Lines
- 1Paste your list, one item per line.
- 2Choose options such as ignore case, trim whitespace and remove empty lines.
- 3Pick whether to keep the first or last copy and whether to sort.
- 4Copy or download the cleaned list.
What does Remove Duplicate Lines do?
Remove Duplicate Lines deletes repeated lines from a list so each item appears only once. Paste a list of emails, phone numbers, keywords, URLs or product codes, and the tool returns the unique lines straight away, with a count of how many duplicates it removed.
Options let you decide what counts as a duplicate (ignore capital letters, ignore spaces at the ends), which copy to keep (the first or the last), whether to drop empty lines, and whether to sort the result A to Z or Z to A.
How does it find duplicates?
The tool reads your text one line at a time and builds a "key" for each line:
- If Trim spaces is on, spaces and tabs at the start and end are removed.
- If Case sensitive is off, the key is made lowercase.
It stores every key it has seen in a hash set, a data structure that can check "have I seen this before?" in roughly constant time. A line whose key is already in the set is a duplicate and is dropped. Because each line is checked once, even a list of several hundred thousand lines is processed in a fraction of a second on a typical laptop.
With Keep last copy, the tool scans from the bottom up instead, so the last occurrence survives in its original position. This matters when later lines are newer, such as an export where the latest entry is at the end.
Which options should I use?
| Situation | Case sensitive | Trim | Keep | Sort |
|---|---|---|---|---|
| Email list | Off | On | First | Optional |
| Keyword research list | Off | On | First | A → Z |
| Code identifiers | On | On | First | Off |
| Log lines (latest matters) | On | Off | Last | Off |
| Product SKUs | On or off, depending on your system | On | First | A → Z |
Email addresses are case-insensitive in practice for most providers (the domain part always is), so turning case sensitivity off is usually right for email lists.
Worked example
Input:
ali@example.com
Sara@Example.com
ali@example.com
sara@example.com
bilal@example.com
With case sensitive off, trim on, keep first and remove empty lines on, the output is:
ali@example.com
Sara@Example.com
bilal@example.com
The stats show 6 lines before, 2 duplicates removed, 3 lines after. The blank line is not counted as a duplicate, it is counted separately as an empty line. "Sara@Example.com" is kept in its original form, because the tool compares lowercase keys but outputs the first line exactly as written (minus outer spaces).
Tips
- Clean the format first. If some lines have different capitalisation you want to standardise, run them through the Case Converter before or after.
- Use sorting to spot near-duplicates. "Karachi" and "Karachi." sit next to each other after sorting, so they are easy to fix by hand.
- Compare before and after with the Text Diff Checker if you need to see exactly which lines were removed.
- Building a sitemap? The XML Sitemap Generator removes duplicate URLs automatically, too.
- Working with JSON or CSV data? Format and convert it with the JSON Formatter first, then de-duplicate rows.
Limitations
- The tool compares whole lines. It won't find duplicates inside a single line or across a comma-separated list on one line.
- It finds exact matches only (after trimming and case). "Muhammad Ali" and "Muhammad Ali" (two spaces) are different, as are "colour" and "color".
- Sorting uses your browser's locale-aware comparison with numeric ordering, so "item 2" comes before "item 10". Accented letters are sorted close to their plain versions.
- Very large inputs (tens of megabytes) depend on your device's memory.
Need to count the words in what is left? Paste the result into the Word Counter.
Frequently asked questions
Does it keep the original order?
Yes, unless you choose a sort option. With keep first, each line stays where it first appeared.
What does trim do?
It ignores spaces and tabs at the start and end of lines, so “apple” and “apple ” count as the same.
Can it handle large lists?
Yes. It uses a hash set, so hundreds of thousands of lines are processed in well under a second on most devices.
Is my list uploaded?
No. Everything runs in your browser.
Last updated: . Written and tested by Abdul Moid Khan, ATechCraft. Read how we build and test tools.