Unicode & Text Authority
TEXT REFERENCE / TOOLS

Alphabetical line sorter

Sort lines alphabetically, in natural numeric order or by length.

How it works

Choose ascending or descending English collation, optionally comparing digit runs numerically, or sort by Unicode code-point length. Equal comparisons retain input order. Preserves duplicates and whitespace; optionally skip exactly empty lines.

Copy sorting summary

Use Copy text sorting summary to copy the displayed output code-point count as tab-separated Metric and Value columns, without copying the sorted text. For example, pear, a and fig on separate lines sort shortest first as a, fig, pear (10 output code points, including two line breaks).

Alphabetical and natural sorting

Ascending is the original English alphabetical order; descending reverses the comparison, not the order of equivalent lines. Enable Natural numeric order to place item2 before item10 in ascending order. It compares digit runs within text rather than parsing each line as a signed or decimal number. Collation depends on browser locale data; results may differ across runtimes.

Sort lines by length

Choose Line length to order shortest first or longest first. Each Unicode code point counts once: 😀 has length 1, while é has length 2. Spaces and tabs count too. This is not a count of grapheme clusters or UTF-16 units. Equal-length lines keep their original order in both directions. For example, pear, a, and fig sort shortest first as a, fig, pear. Natural numeric order is unavailable while sorting by length.

Line handling and privacy

Up to 50,000 UTF-16 units. CRLF and CR become LF. Duplicate lines and leading and trailing spaces are retained. By default, blank lines are retained. A final line break creates an empty element that is sorted like any other line, so the final break can move. Enable Skip empty lines when sorting to omit only zero-length lines, including leading and trailing empty elements. A line containing only spaces, tabs or other whitespace is not empty. For example, Orange, an empty line, and Apple on separate lines become Apple and Orange with no empty line between them in ascending order. Equivalent lines retain their original relative order. Text is processed in your browser; this tool does not upload or store it.

Related: Text line filter · Remove duplicate lines.

Other tools

Text utilities

Encoding and conversion

Typography

Character and case tools