Sort Text Lines
Sort lines of text alphabetically or numerically.
Something not working, or a feature missing?Report a problem or suggest a tool
How to Use
- 1Paste your list, one item per line.
- 2Choose ascending, descending or numeric sort.
- 3Copy or download the sorted list.
Features
- A-Z and Z-A sorting
- Numeric sorting
- Case-insensitive option
Example
Input
banana apple cherry
Output
apple banana cherry
Sort a list of lines alphabetically (A–Z or Z–A) or numerically, instantly in your browser.
Three ways to sort
| Mode | Result for: 10, banana, 2, Apple |
|---|---|
| A → Z | 10, 2, Apple, banana |
| Z → A | banana, Apple, 2, 10 |
| Numeric | banana, Apple, 2, 10 |
Alphabetical sorting compares text character by character, which is why “10” comes before “2”: the character 1 sorts before 2. Numeric mode compares the values instead, so 2 comes before 10. Use it for lists that are only numbers, such as IDs, prices or scores. Lines that are not plain numbers, like “10 kg” or “banana”, count as zero in numeric mode, so they end up at the top in their original order.
Case-insensitive sorting
Case-insensitive sorting is on by default, so “apple” and “Apple” sort together. Turn it off if you need strict ordering by character code. Sorting uses your browser's language rules, so accented letters like “é” are placed next to “e” rather than after “z”.
Good to know
- Blank lines are dropped from the result.
- Duplicate lines are kept. Use Remove Duplicate Lines to remove them.
- Sorting “Last, First” names gives you surname order; sorting “First Last” gives first-name order.
Want numbers mixed with text to sort sensibly, like “item 2” before “item 10”? Pad the numbers with zeros first (item 02, item 10) and then sort A → Z.

