How to use Sort Text Lines Online — A to Z, Length, Numeric
- 1Paste your list or text into the left-hand box.
- 2Choose how to sort — alphabetically, by length or numerically.
- 3Copy the result, or download it as a text file.
About Sort Text Lines
Sorting a list is the kind of thing a spreadsheet does badly when the list is just text. Paste a column into a spreadsheet and you get type coercion, autocorrect, leading zeros disappearing and dates invented out of anything that looks remotely like one. Pasting the same lines here changes nothing about the text — the lines are reordered and handed straight back, so codes, IDs and anything starting with a zero survive intact.
Natural sorting is the detail worth knowing about. A conventional sort compares character by character and therefore places item10 between item1 and item2, which looks wrong to every human who reads it. This tool compares digit runs as numbers, so a list of chapters, versions, filenames or numbered tickets comes out in the order you expect. Alphabetical comparison also follows your browser's locale rules, which keeps accented letters near their unaccented counterparts rather than exiling them to the end of the list.
The other orders each solve a specific problem. Sorting by length, longest first, immediately surfaces the lines that will overflow a fixed-width field or a character limit. Numeric sorting works on lines that mix text and figures, taking the first number it finds — useful for "12 units", less useful for formatted currency, where a thousands comma cuts the number short and gives a wrong order. Reverse simply flips the list you already have, which is the quickest way to turn an oldest-first export into a newest-first one.
Blank lines are dropped unless you ask to keep them, and "Trim spaces around each line" removes leading and trailing whitespace before comparing, so an accidentally indented line does not sort somewhere strange. As with every tool on this page, the sorting happens in your own browser: the list never reaches a server, so it is safe to use on data you would not paste into an online form.