Duplicate Line Remover & Text Sorter
Paste a list of lines, remove duplicates and blank lines, trim whitespace, and sort — all instantly in your browser.
How to Remove Duplicate Lines
- Paste your list of lines into the input box (a sample with duplicates is pre-filled).
- Choose which options to apply: remove duplicates, case-insensitive matching, remove blank lines, and/or trim whitespace.
- If removing duplicates, choose whether to keep each line's first or last occurrence.
- Pick a sort order if you want the result alphabetized, or leave it as "No sorting" to preserve original order. Optionally turn on "Number output lines" to prefix each result line with its position.
- Click "Process" to see the cleaned-up result and a stats breakdown of exactly how many lines were removed as blanks and how many as duplicates.
- Click "Copy Result" to copy the output to your clipboard.
Frequently Asked Questions
Does this work on very large lists?
Yes — processing runs entirely in your browser tab using plain JavaScript string operations, so it can comfortably handle lists of thousands of lines. Extremely large pastes (hundreds of thousands of lines) are limited only by your browser's available memory, not by any artificial cap in the tool.
Can I keep the last occurrence instead of the first?
Yes — use the "Keep which occurrence" setting next to duplicate removal. "Keep first occurrence" (the default) keeps each line's first appearance and discards later repeats. "Keep last occurrence" keeps each line's final appearance instead, in the position where that last occurrence appeared, and discards the earlier repeats.
What does case-insensitive duplicate matching actually do?
When enabled, two lines that differ only in letter case — like "Apple" and "apple" — are treated as the same line for duplicate detection, and only one of them is kept in its original casing, based on the "Keep which occurrence" setting (first or last). When disabled, comparison is exact, so "Apple" and "apple" are both kept as distinct lines.
In what order are the options applied?
The tool trims whitespace from each line first (if enabled), then removes blank lines (if enabled), then removes duplicates using the "keep first" or "keep last" occurrence setting (if enabled), then applies sorting (if selected), and finally numbers the output lines (if enabled). This order means trimming can turn a line that looked non-empty into an empty one before the blank-line filter runs, sorting always happens after duplicates are removed, and numbering is always the last step so the numbers reflect the final, cleaned-up list.
Does numbering the output affect duplicate detection or sorting?
No — line numbers are added only as the final display step, after duplicates have already been removed and sorting has already been applied. Numbers are not part of the text that gets compared, so they're purely a cosmetic prefix added last and never cause two identical lines to be treated as different.
Is my text uploaded anywhere while I use this tool?
No — everything happens locally in your browser tab with plain JavaScript. Nothing you paste is sent to a server.