Text Sorter — Sort, Dedupe, Reverse & Shuffle Lines

Sort lines alphabetically, naturally, by length, in reverse, or shuffled. Optional dedupe, trim, blank-line removal, and case-insensitive comparison. 100% in your browser.

What is a text sorter?

A text sorter reorders the lines of an input — alphabetically, by length, naturally (file2 before file10), in reverse, or shuffled — and optionally drops duplicate or blank lines. It is the everyday tool for tidying up a CSV column, a list of emails, or any one-item-per-line data.

The OpenFormatter text sorter packs every common sort and cleanup option into one panel: A→Z, Z→A, natural, length, reverse, shuffle — combined with dedupe, trim, remove blank lines, and case-insensitive matching. Everything runs locally so customer lists, secrets, and proprietary data stay on your device.

How to sort lines — 4 steps

  1. Paste your lines. Drop one item per line — a list of names, IDs, URLs, file paths, or column values.
  2. Pick a sort mode. Alphabetical, natural, length, reverse, or shuffle — pick the one that matches your data shape.
  3. Toggle cleanup options. Dedupe removes repeats; trim strips whitespace; remove blanks drops empty lines; ignore case folds capitalisation for comparison.
  4. Copy the result. The output panel updates instantly. Hit Copy to send the sorted list to your clipboard.

Sample input and output

Input (9 lines):              Output (sort A→Z + dedupe):
banana                        apple
apple                         banana
cherry                        cherry
date                          date
apple                         elderberry
fig                           fig
elderberry                    grape
banana
grape                         (removed: 2 duplicates)

Combine alphabetical sort with dedupe to produce a clean, unique, ordered list — the GUI equivalent of sort -u.

Alphabetical & Natural

A→Z, Z→A, and natural sort (so file2 sorts before file10) — covers every list-ordering need.

Dedupe + Cleanup

Optional dedupe, trim, remove-blank-lines, and case-insensitive comparison combine into one pass.

Shuffle on Demand

Fisher-Yates shuffle for randomising lists — re-run with one click for a new permutation.

Client-Side Only

All sorting and dedupe runs in JavaScript on your device — customer lists, secrets, and PII stay local.

Common use cases

  • check_circleCleaning a CSV column — trim, dedupe, and sort in one shot
  • check_circleProducing a unique alphabetised list of email addresses
  • check_circleFinding outliers by sorting lines longest-first
  • check_circlePutting file paths in natural order (file2 < file10 < file100)
  • check_circleRandomising a list of names for fair raffle order
  • check_circleReverting a sorted list back to the original order with reverse
  • check_circleComparing two lists by sorting both alphabetically and diffing them
  • check_circleBuilding a deduped seed file for a database import

Equivalent Unix commands

Want to…In this toolUnix
Sort A→ZA → Zsort
Sort + dedupeA → Z + Dedupesort -u
Sort reversedZ → Asort -r
Case-insensitiveIgnore casesort -f
Natural / versionNaturalsort -V
Reverse line orderReverse ordertac
ShuffleShuffleshuf

More text utilities

Diff, count, change case, or reverse text — every tool runs in your browser.

Frequently Asked Questions

How does the alphabetical sort handle numbers?

Alphabetical (A→Z, Z→A) sort compares strings character by character, so file10 sorts before file2 because "1" comes before "2" in lex order. Use Natural sort instead — it groups digits and treats them as numbers, so file2 < file10 < file100 as a human would expect.

What does the dedupe option do?

Dedupe removes the second and subsequent occurrence of any line that has already appeared. With case-insensitive checking on, "Apple" and "APPLE" count as duplicates. Combine with sort A→Z to produce a clean unique-and-ordered list — the equivalent of `sort -u` on Unix.

How does case-insensitive comparison work?

When enabled, both sort comparisons and dedupe checks lowercase the strings first. The output keeps the original capitalisation — only the comparison key is normalised. So "apple", "Apple", and "APPLE" sort together but the visible text is preserved.

Why might I want to sort by length?

Length sort is great for spotting outliers — finding the one absurdly long URL in a list, ordering CSV column names from short to long, or arranging code by line length to skim for complexity. Within the same length, lines are sorted alphabetically as a secondary key.

Is the shuffle truly random?

Yes — the tool uses the Fisher-Yates shuffle backed by JavaScript's Math.random(). For most use cases (randomising a list, picking a winner, generating quiz order) it is sufficient. For cryptographic randomness, use crypto.getRandomValues — but that level of guarantee is rarely needed for line shuffling.

How big a list can I sort?

The browser handles hundreds of thousands of lines comfortably. JavaScript's native Array.sort is O(n log n) and runs in milliseconds for 100k entries. Beyond a million lines you may notice a UI pause, but the sort still completes — no upload, no rate limit.

How does this compare to Unix sort?

Equivalent for most use cases: A→Z = `sort`, dedupe = `sort -u`, reverse = `sort -r`, ignore case = `sort -f`, natural = `sort -V`. The difference is that everything happens in the browser without launching a terminal — handy for quick fixups in copy/paste workflows.

Is the text uploaded?

No. Sorting runs entirely in JavaScript inside your browser. Open DevTools → Network and confirm: zero requests on every sort. Safe for proprietary lists, customer data, or any text you cannot paste into a remote tool.

Text Sorter Online — Sort Lines Alphabetically, by Length, Reverse & Dedupe