Sort & Dedupe Lines
Text
A grab bag for the things you'd do with `sort | uniq | grep -v '^$'` in a shell — alphabetical, descending, or natural sort (so 'item10' comes after 'item2', not after 'item1'); deduplicate (case-sensitive or not); trim whitespace; drop blank lines; reverse the result; or shuffle for a randomized order. Counts shown for input, output, and removed lines so you can see what changed.
Paste lines on the left.
Operations apply in order: trim → remove blank → dedupe → sort → reverse. All processing happens in your browser.
How to use
- Paste your list on the left.
- Pick a sort order and toggle the options you want (dedupe, trim, etc).
- Copy the output from the right panel.
Frequently asked questions
- What's 'natural sort'?
- Sort that understands embedded numbers: 'item2', 'item10' instead of 'item10', 'item2'. Uses Intl.Collator with numeric=true under the hood. Useful for filenames, version numbers, sequential IDs.
- Is shuffle deterministic?
- No — it uses Math.random() with the standard Fisher-Yates algorithm. Click 'shuffle' again to get a different order. If you need a seeded shuffle (for reproducible randomness), this isn't the tool.
- Does dedupe preserve order?
- If sort is 'none', yes — the first occurrence wins and the rest are dropped. If sort is set, dedupe happens before sort, so the output is the sorted set of unique lines.
- What if I want to keep blank lines as separators?
- Uncheck 'remove blank lines'. Blank lines are kept but they're not deduped — every blank line is unique in this tool's view (after trim, they're all empty strings, but the dedupe runs after the trim. So actually they will dedupe.) Real answer: yes, blank lines after trim are equal, so they'll be deduped to one. If you need them preserved, turn off both 'remove blank' and 'trim'.
Related tools
URL Slug Generator
Turn any text into a clean URL slug — strip accents, choose a separator, set a max length.
Markdown Table Generator
Paste CSV, TSV, or pipe-delimited data and get a properly aligned GitHub-flavored Markdown table.
Text Diff Viewer
Compare two pieces of text and see line-by-line or word-by-word additions and removals.
Lorem Ipsum Generator
Generate placeholder text by paragraphs, sentences, or words.
Case Converter
Convert text between UPPER, lower, Title, camelCase, snake_case and more.
Character & Word Counter
Count characters, words, sentences, lines, and bytes in real time.