How to sort text in alphabetical order
- Paste your list. Paste the lines in the Lines to sort box, with one item on each line.
- Choose the order. Pick A to Z, Z to A, Shortest first, Longest first, Reverse or Random.
- Copy the result. The sorted list appears in the Sorted lines box. Press Copy to use it.
What does it mean to sort text?
To sort text is to put its lines in a fixed order. The most common order is alphabetical order, where the lines are arranged by their first letter, then the second letter, and so on, as in a dictionary.
This tool sorts whole lines. Each line is one item, and the words inside a line are not moved.
Features
- Six orders: A to Z, Z to A, shortest first, longest first, reverse and random.
- Numbers sort by value, so item2 comes before item10.
- Ignore case option, on from the start.
- Empty lines removed from the start, with a switch to keep them.
- Copy, select or download the result as a .txt file.
The six orders
| Order | What it does | Example |
|---|---|---|
| A to Z | Alphabetical order | apple, banana, cherry |
| Z to A | Alphabetical order backwards | cherry, banana, apple |
| Shortest first | By number of characters, shortest line at the top | fig, pear, banana |
| Longest first | By number of characters, longest line at the top | banana, pear, fig |
| Reverse | Turns the current order upside down without sorting | Lines 1, 2, 3 become 3, 2, 1 |
| Random | Shuffles the lines. Press Shuffle again for a new shuffle | A different order each time |
With Ignore case on, capital and small letters sort together. With it off, all lines that start with a capital letter come before lines that start with a small letter.
Why the result may not look right
- Capital letters are grouped at the top. Ignore case is off. Tick it for dictionary order.
- Lines with a space at the start come first. A space sorts before letters. Clean the list with the Remove Extra Spaces tool first.
- Letters with accents are not where you expect. The tool uses English sorting rules. Other languages order some letters differently.
- The text stops growing. The box takes up to 500,000 characters.
Related tools
Three other tools on this site work on lines. The tool to remove duplicate lines deletes repeated entries before or after sorting. The reverse text tool can turn the order of the lines around. The random word generator makes lists of words to sort or shuffle.
Is it private?
Yes. The list is sorted inside your browser. It is not sent to our server and is not saved by us.
Frequently asked questions
- How do I put a list in alphabetical order?
- Paste the list with one item per line and keep the A to Z order. The sorted list appears in the result box.
- How are numbers sorted?
- By their value. 2 comes before 10, and item2 comes before item10.
- Can I sort from Z to A?
- Yes. Choose Z to A for reverse alphabetical order.
- Can I shuffle a list?
- Yes. Choose Random. Press Shuffle again for a new random order.
- Is the Sort Text tool free?
- Yes. It is free and you do not need an account.