Sort Words in Text

Paste text and get its words sorted instantly.

Options

Supports escapes: \t \n \r \\
Sorting
The result updates as you type. Ctrl + Enter sorts now.

Sorted words

How to sort words

Paste your text into Your text, or press Load example. Pick Alphabetical, Numeric or By length, choose ascending or descending order, and the sorted words appear instantly. Copy the result or download it as a .txt file. Everything runs in your browser, so nothing you paste is uploaded.

Examples

ModeInputOutput
Alphabetical banana Apple cherry Apple banana cherry
Numeric 10 2 1 1 2 10
By length aaaa b cc b cc aaaa

Limits and edge cases

  • A word is any run of non-whitespace characters (\S+), so punctuation stays attached to the word it touches.
  • Duplicate removal is case-sensitive and exact: Apple and apple count as different words.
  • Numeric mode reads the leading number of each word (10px sorts as 10). Words without a leading number sort alphabetically after the numbered words in ascending order.
  • Use the Separator field to join words with a space, a new line (\n), a tab (\t) or anything else. Escapes \t, \n, \r and \\ are supported.
  • Sorting is stable: words that compare equal keep their original order.

Frequently asked questions

How do I sort words alphabetically?

Paste your text into the input box, keep the Alphabetical mode and Ascending order, and the sorted words appear instantly. Copy the result or download it as a .txt file.

Why does numeric mode sort 2 before 10 but alphabetical mode does not?

Alphabetical mode compares character by character, so 10 comes before 2 because 1 comes before 2. Numeric mode reads the leading number of each word, so 2 comes before 10.

Is sorting case-sensitive?

By default sorting ignores case, so apple and Apple are treated the same. Turn off Ignore case to sort case-sensitively.

Can I remove duplicate words while sorting?

Yes. Turn on Remove duplicates and exact duplicates are dropped before sorting. Matching is case-sensitive, so Apple and apple count as different words.

What counts as a word?

A word is any run of non-whitespace characters, so punctuation stays attached to the word it touches. For example hello, sorts with its comma.

Is my text uploaded anywhere?

No. Sorting runs in your browser with JavaScript and nothing is sent to a server. Inputs under 200 KB are kept in your browser's local storage so they are still there when you come back.