Guide
Sorting lines of text: alphabetical, natural, numeric and by column
A list looks sorted only if it is sorted the way the reader expects. Sort “item 1, item 2, item 10” character by character and “item 10” lands before “item 2”. Sort names with capital letters first and “apple” ends up after “Zebra”. This tool lets you pick the rule that matches the content, and shows what happened to empty and duplicate lines on the way.
Natural or alphabetical?
Alphabetical mode compares lines character by character. That is right for words, but it treats digits as characters, so 10 comes before 2 because “1” comes before “2”. Natural mode reads a run of digits as one number, which is what people expect for file names (photo-9.jpg before photo-10.jpg), chapter titles, version numbers and anything else with numbers inside. Both modes use your browser’s language rules, so accented letters such as é and ö are sorted next to their plain letters rather than after z.
Sorting by the number in a line
“By number in the line” looks for the first number in each line and sorts by its value. It understands minus signs, thousands separators and decimals, so “-4”, “3” and “1,200” come out in the right order even when the lines also contain words, like “Room 12 – 4 beds”. Lines without any number keep their original order at the end, and the counter under the result tells you how many there were, so nothing silently disappears.
Length, word count, reverse and random
Sorting by length counts characters as you see them, so an emoji or a flag counts once. It is handy for checking headlines, finding the longest product names or spotting truncated entries. Word count does the same per word. Reverse simply flips the current order, which turns an oldest-first log into newest-first. Random puts the lines in a fair random order; for more shuffling options, such as groups or a random subset, use Shuffle Text Lines.
Sorting by a column
When each line holds several fields, such as “Lee,30” or tab-separated values copied from a spreadsheet, choose a column and its separator. Only that field is compared, but the whole line moves. Lines that have fewer fields sort as if the field were empty, so they gather at the top in ascending order.
Tidying while you sort
Trimming removes spaces at the start and end of each line, which otherwise make “ apple” sort before “apple”. Removing empty lines and duplicates in the same step saves a second pass; duplicates are compared without regard to case when “Ignore upper/lower case” is on. For a detailed duplicate report, Remove Duplicate Lines is the specialised tool. Ignoring “The”, “A” and “An” gives library-style title order, so “The Zoo” files under Z.
Your list stays on your device
Sorting happens in your browser. Customer names, inventory lists and anything else you paste are not uploaded, and the text is kept only in this tab’s storage until you clear it.
Related tools
Number the sorted list with Add Line Numbers, wrap each line in quotes or tags with Add Prefix and Suffix, or turn the column into a comma-separated list with Column to Comma-Separated List.
Checked against the current version of the Sort Text Lines on .

