Dev Utilities › Text Tools › Remove Duplicate Lines
Remove Duplicate Lines
Paste any list or text and delete every repeated line in one pass — the first (or last) copy of each line survives, everything else is removed, and the original order is preserved.
Quick answer: paste your text, and this tool compares line by line, keeping each line the first time it appears and dropping every later repeat. You control whether matching is case-sensitive, whether surrounding spaces are ignored, and what happens to blank lines — all live, entirely in your browser.
Duplicates found
| Line | Times in input | Copies removed |
|---|
No duplicates — every line in your input is already unique.
Send output to…
Keep working without copy-pasting: your cleaned list travels with you into the next tool.
Try an example list
Load a realistic list, change the options, and watch the breakdown update.
This session
Snapshots, undo and redo live in this tab's memory only — nothing is stored or uploaded, and everything clears when you close the page.
No snapshots yet. Save one to compare a before-and-after clean.
Your tools — tap ☆ to pin a favourite; this page is already in your recent list
Recently used: Remove Duplicate Lines (now)
Favourites: none pinned yet
How to remove duplicate lines
- Paste your text into the left box — a list, a column copied from a spreadsheet, log output, anything with one item per line. A sample list is pre-loaded so you can see the tool working.
- Set the matching rules. Case-sensitive matching treats “Apple” and “apple” as different lines; case-insensitive treats them as one. Ignoring surrounding spaces catches near-duplicates pasted from different sources.
- Decide what survives. Keep the first occurrence to preserve the list exactly as written, or the last occurrence when the newest entry should win — and choose whether blank lines are deduplicated, removed, or kept.
- Copy the result. The cleaned text updates live in the right box, with a count of removed duplicates and a breakdown of which lines repeated. Copy it, download it, or feed it back in as input for another pass.
Worked example
The sample loaded above is an 8-line fruit list with the default settings (case-sensitive, spaces ignored, first occurrence kept):
- apple appears 3 times → 1 kept, 2 copies removed
- banana appears 2 times → 1 kept, 1 copy removed
- Cherry and cherry appear once each — with case-sensitive matching they are different lines, so both stay
- date appears once → kept
Result: 8 lines in, 5 unique lines out, 3 duplicates removed — the list is 37.5% smaller. Switch case matching to “Case-insensitive” and Cherry/cherry merge too: 4 lines out, 4 removed. The tool shows exactly these figures for the sample, so you can check its arithmetic before trusting it with your own list.
When duplicate lines creep in
Merged lists and spreadsheets
Combine two email lists, keyword sets or inventory exports and the overlap comes along twice. Pasting the merged column here removes the repeats in one pass — far faster than hunting duplicates by eye, and safer than a spreadsheet formula you have to re-check.
Logs, code and data files
Repeated error lines, duplicated config entries and copy-pasted code blocks all respond to the same treatment. Keep “spaces must match exactly” for indented code so genuinely different lines are never merged by accident.
Why order is preserved
Many deduplication tricks sort the list first, which destroys the order you wrote it in. This tool never reorders: the surviving copy of each line stays where it first (or last) appeared, so a cleaned list still reads the way you intended. If you do want it sorted afterwards, run the result through the Text Sorter.
Near-duplicates need the options
Real-world duplicates are rarely byte-identical: one copy has a trailing space, another different capitalisation. The case and spaces options exist for exactly that — loosen the matching until the “Duplicates found” table shows the repeats you expected, and no more.
Make deduplication a workflow, not a dead end
Chain the next step
Cleaning is rarely the last step. Use Send output to… above the examples to carry your cleaned list straight into the Text Sorter, Case Converter or Slug Generator — no manual copy-paste, and no risk of pasting the uncleaned version by mistake.
Experiment safely
Not sure whether case-insensitive matching will merge lines you wanted to keep? Save a snapshot first, change the option, and restore the snapshot if the breakdown shows a merge you didn't expect. Undo and redo cover smaller edits the same way.
Learn from the examples
The four example lists in the tool are chosen to show off different options: merged emails for the defaults, keywords for case-insensitive matching, log lines for keep-last, and a shopping list with blank lines. Loading one takes a second and shows exactly what each setting does.
Keep the cheat sheet open
Download the one-page cheat sheet from the session panel: it summarises what counts as a duplicate under each option and the quick workflows for lists, code and logs, so repeat cleans take seconds.
Frequently asked questions
How does this tool remove duplicate lines?
It reads your text line by line and compares each line with the ones it has already seen. The first time a line appears it is kept; every later copy of the same line is dropped. The surviving lines stay in their original order, so a cleaned list reads exactly like the original, minus the repeats.
Is the comparison case-sensitive?
By default, yes: “Apple” and “apple” count as two different lines, because they are not identical. Switch the case option to “Case-insensitive” and they are treated as the same line — the copy that is kept keeps its original capitalisation.
What about lines that differ only by spaces?
With the default “ignore surrounding spaces” setting, a line like “ apple ” (with spaces) matches “apple”, because the comparison trims leading and trailing whitespace first. Turn the setting off if spaces are meaningful in your data, for example in indented code.
Can I keep the last occurrence instead of the first?
Yes. Change “Keep” to “Last occurrence” and the tool keeps the final copy of each repeated line, in the position where that last copy appeared. That is useful for logs and lists where the newest entry supersedes older ones.
Can I remove duplicates from an Excel or CSV list?
Yes — copy the column (or the rows) out of Excel, Google Sheets or a CSV file and paste it here, one item per line. Clean the list, copy the result and paste it back. For whole-row CSV work where fields are separated by commas, each full row is treated as one line.
Is my text uploaded or stored?
No. The deduplication runs entirely in your browser with JavaScript. Your text is never sent to a server, stored or shared, and it disappears when you close the page.
Can I send the cleaned list straight to another tool?
Yes. The “Send output to…” bar carries your cleaned text into the Text Sorter, Alphabetical Sorter, Remove Line Breaks, Whitespace Remover, Case Converter, Word Counter or Slug Generator, so a multi-step clean-up does not need manual copy-pasting.
What are session snapshots?
Snapshots save a copy of your current input inside this tab's memory so you can try different matching options and restore the earlier version in one click. They are never uploaded or written to disk, and they clear when you close the page.