Yueseryueser.com

← All guides

Line Sorter (A–Z): Getting List Order Right

A pasted list of names, tags, or keywords is rarely in order. One pass sorts the lines, and the text inside each line is left alone.

Open the tool:Line Sorter (A–Z)

When you actually need it

Names, tags, keywords, file lists, and directory entries all qualify, as long as there is one item per line. Sorting before deduplicating is a useful habit: duplicates end up next to each other, where you can see and remove them.

Comparing two lists is the other use. Sort both, read them side by side, and missing or added entries show up as a shift. Survey answers, sign-up sheets, and A/B option lists are easier to scan once ordered.

How to avoid the usual surprises

The default comparison is by character code, not by language convention. Every capital sorts before every lowercase letter, so Z comes before a. Accented letters sort after z, and Chinese lines sort by code point rather than pinyin or stroke count. Normalise case first if you want human-readable order.

Spaces and punctuation take part as well, so a leading space moves a line. Indentation or a list marker such as a hyphen sorts by the marker instead of the content, which is rarely what you want. Remove leading spaces and bullets first, and expect blank lines at the top.

Alternatives and when not to sort

For pinyin, Japanese gojuon, or numeric order where 2 comes before 10, use a spreadsheet sort or localeCompare and numeric comparison in a script. This tool does none of that. This tool compares characters only, so none of that happens here.

If you are sorting a table by one column, do not copy the column out and sort it alone; a spreadsheet sorts rows safely and keeps the other fields aligned. Content with a deliberate order, such as steps, chapter numbers, or a priority list, should not be sorted at all.

FAQ

Why do all the capital letters come first?

The sort compares character codes, and capitals have lower code points than lowercase letters, so Z precedes a. Normalise the case before sorting if you want ordinary reading order.

Does it sort Chinese by pinyin?

No. It sorts by character code, which follows neither pinyin nor stroke count. Use a spreadsheet sort or localeCompare in a script when you need pinyin order.

Why did the blank lines jump to the top?

A blank line is an empty string, which compares as the smallest value, so it sorts first. Remove empty lines before sorting if you do not want them there.

Related tool:Line Sorter (A–Z)