Skip to content
ToolZone

Sort Lines Alphabetically

Sort a list of text lines alphabetically, either A to Z or Z to A, useful for organizing names, keywords, or any list before publishing or exporting it.

Runs in your browser. Nothing you enter or upload leaves your device.

Lines
Sorted lines appear here

Sorting is natural, so item2 comes before item10, and follows your language’s alphabet rules for accented letters.

Keyboard shortcuts

Run the main action
⌘ / Ctrl + Enter
Copy the result
⌘ / Ctrl + Shift + Enter
Download the result
⌘ / Ctrl + S
Paste a file or image into file tools
⌘ / Ctrl + V
Search all tools
⌘ / Ctrl + K
Show these shortcuts
?

You can also drop files anywhere on the page.

About the Sort Lines Alphabetically

Sort Lines Alphabetically puts any list in order, one line at a time. Choose A to Z or Z to A and the sorted list appears immediately, with uppercase, lowercase, and accented letters sorted together the way a person would expect.

How it works

The text is split into lines, optionally trimmed, emptied of blank lines and de-duplicated (keeping the first occurrence). Lines are then sorted with the browser's locale-aware comparison in numeric mode, so numbers inside lines sort by value: "item2" comes before "item10", and "Éclair" sorts among the E words.

By default the comparison ignores case; tick Case-sensitive to put uppercase first and treat "Apple" and "apple" as different lines when removing duplicates. Length modes sort by number of characters, Reverse order flips the list as it is, and Shuffle uses the browser's secure random generator.

How to use

  1. 1

    Paste your list or open a text file, one item per line.

  2. 2

    Choose the order: A → Z, Z → A, by length, reverse or shuffle.

  3. 3

    Tick Remove duplicates, Remove empty lines, Trim spaces or Case-sensitive as needed.

  4. 4

    Copy or download the result, or click Use as input to keep working on it.

Worked examples

Mixed case and accents

A list with capitalized and accented words.

Input
Zoë zebra Éclair apple banana
Result
apple banana Éclair zebra Zoë

Case and accents are ignored when comparing, so Éclair sits among the E words.

Numbers in text

Lines that start with numbers.

Input
2 items 10 items
Result
10 items 2 items

Sorting is alphabetical, not numeric, so the first character "1" comes before "2".

Reverse order

Same fruit list, Z → A.

Input
banana Apple cherry
Result
cherry banana Apple
Limitations
Lines are sorted as whole lines; there is no sorting by a column or delimiter. Numbers sort by value only when they appear at the same position in lines, such as item2 and item10.
Assumptions
Each item is on its own line.
Privacy
Sorting happens in your browser and your list is never uploaded.

Frequently asked questions

Does it sort numbers correctly?+

Yes. Sorting is natural, so 2 comes before 10 and item2 before item10.

Is sorting case sensitive?+

Not by default: uppercase and lowercase are compared as equal. Tick Case-sensitive to change that.

How are accented letters sorted?+

They are sorted with their base letter, so "é" sorts with "e" rather than after "z".

Can I sort by line length instead?+

Yes. Choose Shortest first or Longest first.

Related tools