ToolsWhisper
Text & writing tools

Sort Lines Alphabetically

Sort a list of lines A to Z, naturally, by number or by length.

  • Runs in your browser
  • Nothing is uploaded
  • Free, no sign-up
Order
Lines
Sorted

Natural order compares runs of digits as numbers, so file2 comes before file10. Plain alphabetical order would put file10 first.

About this tool

Paste a list and sort it the way you need: alphabetically, in natural order so that file2 comes before file10, by the number each line starts with, by length, or shuffled. Blank lines and duplicates can be removed in the same pass.

How to use it

  1. Paste your lines or open a text file.
  2. Choose how to sort, and the direction.
  3. Copy the sorted list or download it.

Which sort do you need?

Method Orders Example result
Alphabetical Letter by letter, as in a dictionary file1, file10, file2
Natural Numbers inside the text by their value file1, file2, file10
By leading number The number a line begins with 2 pears, 10 apples
By length Shortest line first, ties alphabetical a, bb, ccc
Shuffle Randomly Different every time

For names, titles and most word lists, alphabetical is right. For file names, version numbers and anything with a counter in it, you almost always want natural.

Why file10 sorts before file2

Text is compared one character at a time, and 1 comes before 2. So file10 sorts ahead of file2, because the second character after file is 1 against 2. Natural sorting reads whole runs of digits as numbers and compares those, which matches what a person expects to see.

Capitals and accents

Sorting uses Unicode collation with English rules, not raw character codes. That means é falls beside e instead of after z, and apple is not pushed after Zebra just because capitals have lower codes.

Case is ignored by default. With Case sensitive on, lower case comes before upper case for the same letter. Other languages order some letters differently, such as å in Swedish. This tool does not apply those local rules.

Clean up while you sort

Three options save a second pass: trimming spaces around each line, dropping blank lines, and removing duplicates, which compares lines the same way the sort does. For finer control over what counts as a duplicate, including keeping only the lines that appear once, use Remove duplicate lines.

Frequently asked questions

Is the sort stable?

Yes. Lines that compare as equal, for example Apple and apple with case ignored, keep the order they had in your input.

How are lines without a number handled in the numeric sort?

They are placed after every line that has one, whichever direction you sort in. Thousands separators such as 1,000 are understood.

Is the shuffle suitable for a prize draw?

No. It is fine for ordering a list, but it is not designed for draws where fairness has to be demonstrable.

Is my text uploaded?

No. Sorting happens in your browser.

Related tools