How to sort lines alphabetically
- Paste your list, one item per line. Insert example loads a mixed list.
- Pick a sort: A to Z, Z to A, by number, by length, reverse the current order, or shuffle.
- Tick the options you need: remove duplicates, drop empty lines, ignore capitals. The result updates at once.
- Copy it or download a .txt file.
Natural sort: item2 before item10
Plain alphabetical order compares character by character, so item10 lands before item2 (the character 1 comes before 2). Natural order reads the digits as a number. The same list both ways:
item10 item2 Banana apple item1 cherry apple Apricot
| Setting | Result (lines joined with ·) |
|---|---|
| Natural order on (default) | apple · apple · Apricot · Banana · cherry · item1 · item2 · item10 |
| Natural order off | apple · apple · Apricot · Banana · cherry · item1 · item10 · item2 |
Natural order is what file managers and spreadsheets show, so it is the default. Sorting uses your browser's language rules, so accented letters sort next to their base letter (é after e) instead of at the end.
Sort numbers, and what happens to lines without one
The number options read the first number in each line, with thousands separators (1,250) and decimals. In this list the amount is the second word, so Sort by column is set to 2:
Rent 1,250 Coffee 4.5 Flight 389 Books 62.99 Notes
Coffee 4.5 Books 62.99 Flight 389 Rent 1,250 Notes
Lines with no number, such as the last one, go to the end and the tool tells you how many there were.
Sort by column or word
Set Word or column number and pick the separator to sort lines by one field while keeping the whole line. Commas make it work for simple CSV lines, tabs for pasted spreadsheet rows. Sorting the people below by the third field (age, low to high):
Smith, Ana, 31 Okafor, Ben, 27 Lopez, Chloe, 45
Okafor, Ben, 27 Smith, Ana, 31 Lopez, Chloe, 45
This sorts text only. It does not understand quoted CSV fields that contain the separator.
Reverse, shuffle and remove duplicates
Reverse order flips the list without sorting it, handy for a log that should start with the newest entry. Shuffle reorders the lines at random using your browser's cryptographic random generator, so every order is equally likely. A shuffle changes every time you paste or change an option; to pick one random line only, use the spin the wheel. Remove duplicate lines keeps the first copy of each line; for the repeated lines themselves use remove duplicate lines.
With capitals respected, uppercase letters come before lowercase ones of the same letter:
b Bb A ab B
A ab B b Bb
Sorting dates, versions and mixed lists
- Dates sort correctly as text only in year-month-day form (2026-03-12). 12/03/2026 sorts by day first. Reformat dates with find and replace before sorting, or put the year first.
- Version numbers such as v1.9 and v1.10 are ordered correctly by natural order, which reads every run of digits as a number.
- Names: to sort by surname, write them as Smith, Ana and sort by column 1 with commas as the separator.
- Mixed lists: sorting by length is a quick way to find the longest titles or the shortest keywords in a list.
Sorting is stable: lines that compare as equal keep the order you pasted them in.
Related tools
- Remove duplicate lines – dedupe a list and see which lines repeat
- Find and replace
- Reverse text – reverse letters, words or lines
- Text compare
Sort lines FAQ
How do I sort lines alphabetically?
Paste the lines, one per line, and leave A to Z selected. The sorted list appears immediately; copy it or download it.
How do I sort numbers correctly?
Pick Numbers, low to high. The tool reads the first number in each line, including values such as 1,250 and 4.5, so 10 comes after 9. Lines without a number go last.
What is natural sort?
Natural sort treats digits inside text as numbers, so item2 comes before item10. Plain alphabetical sort would put item10 first. It is on by default and can be switched off.
Can I sort by the second word or column?
Yes. Enter the word number and choose the separator (spaces, commas, semicolons, tabs or pipes). The whole line is kept and the chosen field decides the order.
Is the shuffle fair?
Yes. It uses the browser's cryptographic random number generator with an unbiased shuffle, so every possible order is equally likely.
Does it handle accents and other alphabets?
Yes. Sorting follows your browser's language rules, so é sorts with e and ñ near n. Results can differ slightly between languages and devices.
Is my list uploaded anywhere?
No. Sorting happens in your browser, and nothing is sent to a server or stored.