Sort Lines

Sort lines of text, with natural and random ordering

Runs in your browserUtility05Text & Diff

What is Sort Lines?

A line sorting tool orders text four ways — ascending, descending, by length, and shuffled — with an option to ignore case and a natural sort mode that puts item2 before item10. Chinese characters are compared by pinyin rather than by code point. Sorting happens locally in your browser.

How to use Sort Lines

  1. 1Paste your content with one item per line.
  2. 2Pick a sort mode, and switch on natural sort when the lines contain version numbers or numeric suffixes.
  3. 3Copy the result.

Frequently asked questions

What is natural sort order?+

Plain lexicographic sorting compares character by character, so it places item10 before item2 because "1" sorts before "2". Natural sort treats each run of digits as a number instead, giving you the intuitive item2, item10 ordering. Turn it on for filenames, version numbers, and anything else with an embedded counter.

How is Chinese text sorted?+

By pinyin, using the browser Intl.Collator with the zh-Hans-CN locale. That matches how Excel sorts Chinese and is what Chinese readers expect. Sorting the same list by raw Unicode code point instead produces an order that looks essentially random to a human.

Related tools

All tools