Sort text alphabetically

Sort the lines of your text from A to Z or from Z to A. Each line is one item. Everything runs in your browser and nothing is uploaded, so you can sort private lists such as names or invoices.

Order
Sort by

How it works

  1. Paste your text

    Type or paste the text in the left box, or open a .txt file. No text to hand? Click Example.

  2. Instant result

    The result appears as you type. Change the options and see straight away what changes.

  3. Copy or download

    Copy the result with one click, save it as a file or use it as input for a next step.

Three ways to sort

  • Alphabet: strict character-by-character order.
  • Alphabet, smart numbers (2 before 10) (the default): numbers inside the text are compared as numbers, so item 2 comes before item 10.
  • By length: shortest line first.

Example

pear, Apple, banana, Éclair, item 10, item 2 and apple become Apple, apple, banana, Éclair, item 2, item 10 and pear. Capitals are ignored by default, and the accent in Éclair does not push it to the end.

Options

  • Ignore case: on by default; off, lowercase and uppercase letters are ordered separately by the browser's rules.
  • Remove duplicate lines: tick it to sort and clean in one step.
  • Leave out empty lines: on by default.

Related

To reverse an existing order, use reverse lines. For doubles only, there is remove duplicate lines, which keeps the original order. To shuffle instead of sort, see randomize text.

Frequently asked questions

Why does "item 10" come before "item 2" in one mode?

In plain alphabetical order, text is compared character by character and `1` comes before `2`, so `item 10` comes first. Choose *Alphabet, smart numbers (2 before 10)* to compare whole numbers, which puts `item 2` before `item 10`.

How are accented letters sorted?

With their base letter: `Éclair` sorts among the E words, not after Z. The browser's sorting rules for the page language are used.

Can I sort and remove duplicates at once?

Yes, tick the option to remove duplicate lines. The note reports how many were removed. With *Ignore case* on, `a` and `A` count as the same line.

How do I sort by length?

Choose *By length* as the method. The shortest line comes first; use *Z → A* to put the longest first.