TASK
Sort lines and remove duplicates
Take a list of items (one per line), sort them alphabetically or naturally, and remove duplicate lines.
- 1
Sorting and deduplicating a line list is a common data prep step — cleaning log entries, deduplicating URLs, preparing import lists. Sorting makes diffs readable; deduplication removes redundant entries.
- 2 Sort & Unique →
Paste lines. The tool sorts (ascending/descending, case-sensitive/insensitive, natural or lexicographic) and optionally removes duplicates.
- 3 text-trim → sort-unique
Use the chain to deduplicate then sort in one pass, with options for trimming whitespace and ignoring blank lines.
Frequently asked questions
- What is 'natural' sort vs lexicographic?
- Lexicographic sorts character by character: 'file10' < 'file2' (because '1' < '2'). Natural sort treats digit sequences as numbers: 'file2' < 'file10'. Use natural sort for filenames and version-like strings.
- How are duplicates identified?
- By exact line equality after optional trimming. Lines that differ only in trailing whitespace are considered different unless you enable trim. For case-insensitive dedup, enable that option — but the first occurrence's case is preserved.
Workflows that solve this
Normalize case then sort and deduplicate
Convert all text to lowercase then sort lines alphabetically and remove duplicates. PIPELINE
Hex-encode text and analyze
Convert text to its hexadecimal representation then compute character statistics on the hex output. PIPELINE
Normalize and sort identifiers
Clean whitespace, convert to lowercase, then sort and deduplicate a list of identifiers. PIPELINE
Format raw XML document
Pretty-print a minified or unformatted XML document for human review. PIPELINE
Clean text then analyze word statistics
Trim and normalize text, then compute word/character/line statistics. PIPELINE
Clean and sort text lines
Trim whitespace from every line, then sort and deduplicate the result for a clean canonical list. PIPELINE
Dedent Text and Trim
Remove common indentation then trim whitespace. PIPELINE
Deduplicate lines and count words
Sort and remove duplicate lines, then count the remaining words to get a quick inventory. PIPELINE
Trim, dedupe, and sort lines
Clean a list: trim whitespace from every line, remove duplicates, and sort the result. PIPELINE
Extract Emails and Sort Unique
Extract email addresses then sort and deduplicate. PIPELINE
Trim Text and Deduplicate Sort
Trim whitespace then sort and deduplicate lines. PIPELINE
Normalize whitespace and wrap text
Clean up messy text by trimming lines, removing blank lines, then wrapping to a readable line width. PIPELINE
Learn more
Want to understand why?
How to Remove Stop Words
A beginner-level guide covering stop-words, nlp, text. Includes step-by-step instructions, common errors, troubleshooting tips, and security considerations for stop-words. TUTORIAL
How to Sort and Deduplicate Text
Sort lines alphabetically or numerically and remove duplicate lines from a list. TUTORIAL
Sorting Algorithm
Sorting algorithms arrange elements in order—quicksort, merge sort, and heapsort are common—with complexity ranging from O(n log n) to O(n²). GLOSSARY
Related tools
Sort & Unique
Sort lines alphabetically, numerically, by length, or naturally; deduplicate; reverse or shuffle. Free, private, and 100% client-side. TOOL
Text Trim & Clean
Remove empty lines, trim whitespace, collapse spaces. Free, private, 100% client-side. TOOL
Regex Replace
Find and replace text using regular expressions. Free, private, 100% client-side. TOOL