Remove Duplicate Lines
Delete duplicate lines from any list or text, with trim, case and sort options — instantly in your browser.
Paste a list and strip out duplicate lines instantly, with trim, case and sort options. Free. No sign-up. Runs in your browser, nothing is uploaded.
Paste a list, get every line exactly once. The tool keeps the first occurrence of each line, preserves your original order and shows how many lines went in, came out and were removed, so you can see at a glance whether the clean-up did what you expected.
It is the quickest way to merge two keyword exports, tidy an email list before an import or count the distinct values in a column without writing a formula.
The four switches and what they change
- Trim each line (on by default) strips spaces and tabs at the start and end of each line before comparing, and the kept lines come out trimmed too. Without it,
appleandapple(with a trailing space) are two different lines. Spaces inside a line are never touched. - Case-insensitive match treats
Apple,appleandAPPLEas one line and keeps whichever spelling appears first. Leave it off for anything where capitalisation carries meaning: API keys, hashes, case-sensitive product codes. - Remove empty lines drops blank rows completely. With it off, blank lines are deduplicated like any other line, so the first blank stays and every later one goes.
- Sort A → Z alphabetises the unique lines after duplicates have been removed. It is a natural-language sort, not a computer-style code-point sort, which matters for the edge cases further down.
Worked example: one list, four results
Take this seven-line paste, where the third line has a trailing space and the fifth line is empty:
apple
Banana
apple
APPLE
banana
cherry
| Options switched on | Lines out | Removed | What you get |
|---|---|---|---|
| None (trim off) | 7 | 0 | Nothing matches exactly; apple still has its space |
| Trim (the default) | 6 | 1 | apple collapses into apple |
| Trim + case-insensitive | 4 | 3 | apple, Banana, the blank line, cherry |
| Trim + case-insensitive + remove empty | 3 | 4 | apple, Banana, cherry |
The jump from 6 to 4 is the whole story of case folding: APPLE and banana vanish because earlier lines already "own" those words. If those spellings matter to you, that is your cue to leave the option off.
Edge cases that surprise people
- The trailing newline. If your paste ends with a line break, "Lines in" counts an extra empty line. It is not a bug, it is how text works; tick Remove empty lines if you do not want it.
- Numbers sort as text. With sorting on,
item10comes beforeitem2, because the comparison goes character by character and1is smaller than2. Pad numbers with zeros (item02) or use the 0 → 9 order in the text sorter if you need numeric order. - Sorting is human-friendly. Lowercase and uppercase versions of the same word end up next to each other (
apple,Apple,banana) rather than all capitals first, as you would get from a plain byte sort. - Near-duplicates survive.
https://example.comandhttps://example.com/,MüllerandMueller, two spaces versus one in the middle of a line: all different. Normalise those before you paste. - Whole CSV rows are compared as a unit. Two rows that differ only in a timestamp column are not duplicates. Paste just the column you care about.
Doing the same thing elsewhere
Sometimes you want the result inside another workflow. The equivalents, and how they differ from this tool:
| Method | Keeps original order? | Notes |
|---|---|---|
| This tool | Yes (unless you sort) | Live preview, counts in/out, optional trim and case folding |
sort -u file.txt (Unix shell) | No, output is sorted | Fast for huge files; ordering depends on your locale |
awk '!seen[$0]++' file.txt | Yes | The classic "keep first occurrence" one-liner; no trimming |
| Spreadsheet "remove duplicates" feature | Yes | Works on selected columns or whole rows; changes the sheet in place |
For a one-off list of a few thousand lines, pasting here is quicker than opening a terminal. For a multi-gigabyte log, use the shell.
Checking what was removed
The "Removed" counter is a sanity check. If it is far higher than you expected, an option is probably merging lines you meant to keep, case folding being the usual culprit. Run the original and the cleaned list through the text diff to see exactly which lines went, and use the word & character counter if you need totals beyond line counts.
Frequently asked questions
Related tools
All Text & Writing tools →- Case ConverterConvert text to UPPERCASE, lowercase, Title Case or Sentence case — instantly, in your browser.
- Word & Character CounterCount words, characters, sentences, paragraphs and reading time as you type.
- Word Frequency CounterPaste any text to see how often each word appears — total and unique word counts plus a ranked table of the most-used words, with an option to skip common stop words.
