Sort Lines

Sort lines alphabetically from A to Z or Z to A, in natural number order, by length or by strict character code.

Options
Order

Processed in your browser. Nothing you type is uploaded.

How it works

Alphabetical sorting uses your browser’s language-aware collation, so accented letters sort next to their base letters (“Éclair” near “eclair”) and case differences don’t split the list into capitals-first and lowercase-last groups.

Natural sorting also compares numbers by value, so “item2” comes before “item10”. Strict character code order is the traditional computer sort: all capitals before all lowercase letters, and digits compared one by one.

Rules this tool follows

  • Z–A reverses whichever method is selected.
  • “By length” sorts by number of characters, then alphabetically for lines of equal length.
  • Empty lines are removed by default; if kept, they sort to the top in A–Z order.
  • Lines that compare as equal keep their original relative order.

Example

Input

item10
Banana
apple
item2
Éclair
cherry

Output

apple
Banana
cherry
Éclair
item10
item2
Alphabetical sorting puts “item10” before “item2”. Choose “Natural” to get item2, then item10.

Common uses

  • Alphabetizing names, glossaries, bibliographies and word lists.
  • Ordering file names or version numbers naturally.
  • Grouping similar entries before reviewing or deduplicating them.

Limitations and notes

  • Collation follows general Unicode rules and your browser’s language; some languages have local conventions (such as Swedish å after z) that may differ.
  • Each line is sorted as a whole. To sort by a column of CSV data, use a spreadsheet.

All text cleaners