Text Sorter

Sort any list by alphabet, length or numeric value, or shuffle it randomly. Clean up blank lines and duplicates in the same pass, add line numbers or a prefix, then copy the result.

Sorting & cleanup
Sort
Cleanup

Fixed order: trim → collapse spaces → remove blank lines → deduplicate → sort → line numbers → prefix/suffix.

Output lines
Paste your list here, one item per line…
Input lines0
Output lines0

Need finer deduplication options? Use the dedicated duplicate-line remover. Everything runs locally; shuffling uses cryptographically strong randomness.

How to use

  1. Paste your list into the input box, one entry per line.
  2. Pick a sort order — A → Z, Z → A, shortest first, longest first, native order or shuffle.
  3. Choose the language rules if your list is not English, so accents and CJK characters sort the way readers expect.
  4. Turn on cleanup options if you want blank lines removed or duplicates dropped, then copy or download.

Details

Sorting text is a place where small implementation choices become visible. This tool creates a single collator per run rather than one per comparison — the difference is invisible on a twenty-line list and decisive on a hundred thousand-line one, where a naive implementation can hang the browser for minutes.

Comparison can be made case sensitive or not, and either way you can sort by the raw text or by its natural reading. Cleanup, sorting, numbering and affixing all happen in one deterministic pass, so the same input and the same settings always produce the same output — except for shuffle, which is deliberately random.

FAQ

What is “natural number order”?

In a plain alphabetical sort, “item10” comes before “item9”, because the character “1” sorts before “9”. Natural order compares the numbers inside the text instead, so “item9” comes before “item10” — what you would expect when numbering files, chapters or versions.

Which language rules should I choose?

Pick the language your list is mainly written in. Collation is language-specific: Swedish sorts å after z, while German and English treat it as a variant of a. The right rules also place Chinese characters in pinyin order and Japanese kana in gojūon order. Choosing “English” for a CJK list will still work, but the order will follow code points rather than reading order.

How is the shuffle done — is it fair?

Shuffling uses a Fisher–Yates shuffle driven by the browser's cryptographically secure random number generator, not Math.random. Every permutation is equally likely, and the “Shuffle again” button re-randomises using a fresh seed.

In what order are the cleanup options applied?

The order is fixed and shown in the interface: trim lines → collapse inner spaces → remove blank lines → remove duplicates → sort → add line numbers → add prefix and suffix. Numbering and affixes are applied last on purpose, so they never interfere with the comparison.