All tools › Text, Fonts & Symbols › Text Utilities
Paste a list and sort its lines A to Z, Z to A, by length, by number or in natural order.
Put a list in order, one line per item
Paste a list and this tool sorts its lines alphabetically from A to Z or Z to A. It can also sort by line length, by the number at the start of each line, or in natural order so that “file2” comes before “file10”. Reverse and shuffle are included.
It is useful for name lists, reading lists, glossary terms, file names, keyword lists and anything else kept as one item per line. The sorting is done in your browser, and the list is not uploaded.
How to sort lines
- Paste the list into Your lines.
- Choose the Sort order.
- Under Capital letters, ignore them (the usual choice for words) or let capital letters come before small letters.
- Decide what to do with Spaces at the start and end of a line, Empty lines and Duplicate lines.
- For Shuffle only, you may type a Seed to get the same random order again.
- Press Copy next to the sorted text.
What each sort order does
A to Z: compare two lines character by character; the first different character decides
Characters are compared by their code numbers. In that order a space comes first, then digits 0 to 9, then capital letters A to Z, then small letters a to z, then accented letters. When capital letters are ignored, every line is compared in lowercase but shown as you typed it. Lines that compare equal stay in their original order.
| Sort order | Rule |
|---|---|
| A to Z / Z to A | Character by character, as described above, or the opposite. |
| Shortest / longest line first | By number of characters. Lines of equal length are placed A to Z. |
| By leading number | Reads a number at the start of the line: an optional + or − sign, digits and an optional decimal point. Lines with no leading number go last, in their original order. |
| Natural order | Each line is cut into runs of digits and runs of other characters. Digit runs are compared as whole numbers, so 2 comes before 10. A digit run sorts before text. |
| Reverse the current order | Last line first. Nothing is compared. |
| Shuffle | A random order. Every line keeps its text. |
Trimming, removing empty lines and removing duplicates all happen before sorting. Duplicates are found with the same capital-letter setting as the sort, and the first copy is the one kept.
Worked example
Paste seven lines: Chapter 10, chapter 2, Appendix, Chapter 1, an empty line, zebra notes, Chapter 2. With every option as it loads (A to Z, capital letters ignored), the result is “6 lines sorted”:
Appendix, Chapter 1, Chapter 10, chapter 2, Chapter 2, zebra notes.
Chapter 10 lands before chapter 2 because the character “1” comes before “2”. Now choose Natural order and set Duplicate lines to Remove them:
| Row | Value |
|---|---|
| Sorted lines | 5 lines sorted |
| Sorted text | Appendix, Chapter 1, chapter 2, Chapter 10, zebra notes (one per line) |
| Lines in | 7 |
| Lines out | 5 |
| Empty lines removed | 1 |
| Duplicate lines removed | 1 |
| First line | Appendix |
| Last line | zebra notes |
“Chapter 2” was dropped as a duplicate of “chapter 2”, which came first.
Choosing the right order
Use A to Z for words and names. Use natural order for anything with numbers inside the text: file names, chapter titles, street addresses, version labels. Use the leading-number order for lines that start with a quantity, a score or a price without a currency sign, especially when decimals or negative numbers are involved, since natural order reads digits only as whole numbers.
Limits
- This is not dictionary order for every language. Accented letters sort after z, so “éclair” comes after “zebra”. Sorting rules that depend on a language are not applied.
- Names are sorted by the start of the line. To sort people by last name, the last name has to come first on each line.
- The leading-number order does not read thousands separators, currency signs or dates. “1,200” is read as 1.
- Shuffle without a seed uses your browser’s random function. It is fine for games and class lists, not for security.
- The text can be up to 100,000 characters.
Frequently asked questions
Why does 10 come before 9 in A to Z order?
A to Z compares characters, and “1” comes before “9”. Choose natural order or the leading-number order to sort by value.
How do I sort in reverse alphabetical order?
Choose Z to A. “Reverse the current order” is different: it flips the list as pasted without sorting it.
Do lines starting with a capital letter sort first?
Only if you choose “Capital letters before small letters”. With capitals ignored, “apple” and “Apple” sort together.
Will sorting change the text of my lines?
No, apart from trimming spaces at the ends if that option is on. Lines are only moved, and removed if you ask for empty or duplicate lines to go.
Related calculators
- Remove Duplicate Lines – more control over which repeated line is kept.
- Find and Replace Text – change a word or separator in every line.
- Random Team Generator – split a list of names into random teams.
- Character Counter – check the length of a line or the whole list.

