AZ Tools

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.

Output (0 lines)
Paste lines on the left.

Operations apply in order: trim → remove blank → dedupe → sort → reverse. All processing happens in your browser.

How to use

  1. Paste your list on the left.
  2. Pick a sort order and toggle the options you want (dedupe, trim, etc).
  3. 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