Sort Text Lines
Sort lines A–Z, Z–A, naturally by number, by line length, reverse order, or random shuffle.
Open ToolDeduplicate lists, keywords, or logs while keeping first or last occurrences cleanly.
Each output panel above updates locally in real time as your text changes. Here is what every metric or transformation produced by Remove Duplicate Lines represents:
Remove Duplicate Lines is a fast list deduplication utility that scans line-by-line input and preserves only a single unique entry for repeated strings.
Whether consolidating subscriber email lists, cleaning scraped sitemap URLs, merging keyword research sheets, or trimming redundant log messages, manual spreadsheet filtering breaks easily when stray trailing spaces disguise duplicates.
Lines split across CRLF/LF breaks pass through an O(1)-lookup JavaScript `Map` structure. By default, leading/trailing spaces are trimmed before comparison so `"apple"` and `"apple "` register as the exact same row rather than sneaking through as phantom uniques.
Scanning forwards keeps the first occurrence (`keepLast` off), whereas toggling "Keep last occurrence" scans backwards from bottom to top while preserving final-state ordering—vital when later log rows supersede earlier ones.
Uses linear hash-map keying with optional Unicode locale-lowercased normalization and `Intl.Collator` natural numeric sorting when "Sort output" is active.
Note that Duplicates Removed tracks `originalLines - uniqueLines`, which includes stripped blank lines when Ignore empty lines is active.
Explore Next: Sort Text Lines if you need Z–A, length-based, or randomized line ordering • Text Diff Checker to compare original and deduplicated lists visually • Browse all 30 text tools
Input: Berlin
berlin
Tokyo
TOKYO
Output / Insight: With Case-sensitive unchecked and Trim whitespace checked, outputs 2 lines ("Berlin", "Tokyo") and removes 2 duplicates.
Input: ItemA
ItemB
ItemA (updated vs plain duplicate)
Output / Insight: Checking "Keep last occurrence" retains the final matching appearance when ordering matters.
One of the lines almost certainly ended with an invisible space or tab. Keep Trim whitespace checked to normalize line edges cleanly.
Yes. Check Case-sensitive so "API_Key" and "api_key" remain distinct entries.
Instead of keeping the earliest position where a duplicate appeared, the final position in the list is retained—useful when newer entries replace older copies.
Yes. Our optional Sort output check uses `Intl.Collator` numeric comparison so multi-digit numbers order naturally.
Sort lines A–Z, Z–A, naturally by number, by line length, reverse order, or random shuffle.
Open ToolStrip blank or whitespace-only lines completely or collapse gaps to single line breaks.
Open ToolSanitize copied text: strip HTML, smart quotes, URLs, emails, emojis, and extra whitespace.
Open ToolList every unique word sorted by occurrence count with stop-word and length filters.
Open Tool