# Text sorter

URL: https://shahid09.is-a.dev/tools/text-sorter/
Author: Muhammad Shahid (https://shahid09.is-a.dev/)
Free tool · runs in your browser

Sort any list alphabetically, by number or by length, or shuffle it at random, and clear duplicates as you go.

**Quick answer:** Paste a list with one item on each line and choose an order: A to Z, natural (file2 before file10), by number, by length or a random shuffle. You can reverse the order, ignore capitals, remove duplicates and remove blank lines. It follows real alphabet rules, so accented letters sort next to their base letters.

## How to use it

1. **Paste your list.** One item per line.
2. **Choose the order.** Alphabetical, natural, numeric, by length or shuffled.
3. **Copy the result.** It updates as you change the options.

## Example

Sorted A to Z, capitals do not separate the items:

Input:

```
pear
Apple
banana
```

Output:

```
Apple
banana
pear
```

## Common errors and how to fix them

- **Numbers sort as 1, 10, 2**: A to Z compares text. Choose "By number" or "Natural" instead.
- **The items did not move**: The list is probably on a single line. Put each item on its own line first.

## Frequently asked questions

### How do I alphabetize a list?

Paste it with one item per line and keep the default "A to Z". Turn on "Reverse order" for Z to A.

### What is natural sort?

Sorting that reads numbers inside text as numbers, so file2 comes before file10. In plain A to Z, file10 comes first because 1 sorts before 2.

### Why does 10 come before 9 in A to Z?

Alphabetical sorting compares character by character, and 1 comes before 9. Choose "By number" to compare the values.

### How does "By number" handle text?

It sorts by the first number on each line, ignoring thousands commas. Lines without a number go last.

### Is the shuffle truly random?

It uses the Fisher-Yates method, which makes every order equally likely, driven by your browser's random generator. That is fine for classroom draws but should not decide anything with legal or financial stakes.

### Are capital letters sorted separately?

Not by default: "apple" and "Apple" sort together. Turn off "Ignore case" to treat them as different.

### Can I sort a comma-separated list?

Put each item on its own line first by replacing the commas with line breaks in any editor.

### Is my list uploaded?

No. Sorting happens entirely in your browser.

### Does sorting keep duplicate lines?

Yes, unless you turn on "Remove duplicates". To remove repeats and keep the original order instead, use the [duplicate line remover](https://shahid09.is-a.dev/tools/duplicate-line-remover/).

### Does it sort Hebrew and other alphabets?

Yes. It follows your browser's language-aware sorting rules, so letters sort in their alphabet order. To flip the result, use "Reverse order".

## Related

- [Duplicate line remover](https://shahid09.is-a.dev/tools/duplicate-line-remover/)
- [Text reverser](https://shahid09.is-a.dev/tools/text-reverser/)
- [Remove extra spaces](https://shahid09.is-a.dev/tools/remove-extra-spaces/)

## Sources

- [Wikipedia: Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle)
- [MDN: Intl.Collator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator)
