Skip to content
ZeroServer.tools

Array Sorter

Sort a list of values numerically, alphabetically, in reverse, or shuffled — with optional deduplication.

Sort mode
Output format

5 of 9 values could not be parsed as a number and were sorted to the end alphabetically.

9 values

Sorted output

How the array sorter works

Paste any list of values — one per line, comma-separated, or a mix of both — and this tool treats it as an array and reorders it instantly. Numeric mode compares values as numbers (so 2 correctly sorts before 10, unlike a plain text sort), with any non-numeric entries pushed to the end and sorted alphabetically. Alphabetical mode uses locale-aware, case-insensitive string comparison. Reverse simply flips the current input order without otherwise re-sorting it, and Shuffleproduces a fresh random order each time you click "Shuffle now" using a Fisher-Yates shuffle. The optional "Remove duplicate values" toggle keeps only the first occurrence of each value (case-insensitive) before sorting. Everything runs locally in your browser — nothing is uploaded anywhere.

For numbers-only input with sum/min/max stats, try the Number Sorter. For sorting whitespace-separated words by frequency or length instead, see the Word Sorter.

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Sorting a pasted list numerically rather than as text.
  • Deduplicating and sorting a list in one pass.
  • Shuffling a list to remove ordering bias.
  • Reversing a sorted list without re-sorting it.
  • Sorting values that are not lines of text, such as a pasted array literal.

Frequently Asked Questions

Why does a default JavaScript sort put 10 before 2?
Because `Array.prototype.sort` converts elements to strings and compares them lexicographically unless given a comparator. `[10, 2].sort()` returns `[10, 2]` — a genuine surprise that has shipped in production more times than anyone can count.
What is a natural sort?
One that compares embedded digit runs numerically, so `file2` precedes `file10`. It is what file managers do and what a plain sort does not, and it is the right choice for anything with a number inside a name rather than at the start.
How does the shuffle work?
Fisher-Yates, which produces a uniform permutation. The tempting alternative — `sort(() => Math.random() - 0.5)` — is measurably biased and, worse, its behaviour depends on the engine's sort algorithm, so the bias differs by browser.
Is sorting stable?
Yes in every current JavaScript engine — the specification has required it since ES2019. Stability means equal elements keep their original relative order, which is what lets you sort by one field and then another and get a meaningful two-level ordering.
How should accented characters sort?
By locale, through `Intl.Collator`, not by code point. A code-unit sort puts every accented letter after Z; a Swedish collation puts å, ä and ö at the end of the alphabet deliberately while a German one interleaves them. Both are correct for their language.

Common errors and gotchas

  • Sorting numbers as text, where 10 sorts before 9.
  • Assuming a stable sort, so equal elements keep their original relative order.
  • Sorting mixed types, where the comparison rules become implementation-specific.
  • Sorting a list whose order carried meaning.
  • Deduplicating case-sensitively when the values were meant to be compared loosely.

Related Formatters & Validators tools

Private & free — this tool runs entirely in your browser.

IndieKitShip your Next.js startup in days.affiliate