Skip to content
Toolora

Text Sorter

Sort a list of lines A→Z, Z→A, by number, by length, in reverse, or shuffled — with natural ordering so item2 comes before item10.

Text Runs in your browser Works offline
Loading tool…

How it works

Alphabetical sorting uses your browser's locale-aware comparison with natural number handling turned on. That is why item2 lands before item10 — a plain character-by-character sort would put item10 first because “1” precedes “2”.

Blank lines are dropped before sorting, since a list of values rarely wants them back in an arbitrary position. Shuffle uses a Fisher–Yates shuffle, which gives every ordering an equal chance rather than the subtle bias a naive sort-by-random produces.

The formula

Alphabetical

locale comparison with numeric: true

By length

compare character counts, shortest or longest first

Shuffle

Fisher–Yates: for i from n−1 down to 1, swap with a random earlier index

Worked examples

ScenarioWorkingResult
item10, item2, item1A → Z with natural orderingitem1, item2, item10
Banana, appleA → Z, case insensitiveapple, Banana
A list of namesShuffleA fair random order

When you'd use it

  • Alphabetising a glossary, index or reference list
  • Ordering version numbers or SKUs correctly
  • Randomising a list for a draw or a test order
  • Finding the longest or shortest entries in a list

Common questions

Why does item2 come before item10?

Because sorting is natural rather than character-by-character: embedded numbers are compared as numbers. A plain string sort would give item1, item10, item2, which is almost never what you want.

How does case sensitivity change the result?

With it off, “apple” and “Apple” sort together as the same word. With it on, capital letters sort before lowercase ones, so every capitalised entry is grouped ahead of the rest.

Is my text uploaded anywhere?

No. The whole tool runs in your browser, so what you paste never leaves your device. That matters when the text is a draft, a transcript or anything covered by an NDA.