Sort Lines Alphabetically

Sort any list of lines from A to Z using locale-aware comparison.

This tool runs entirely in your browser. Your files are never uploaded to a server.

What this tool does

Splits your text into lines and reorders them alphabetically from A to Z, using your browser's locale-aware string comparison.

How to use it

Paste a list, one item per line, into the box — the sorted result appears immediately below it. Editing the input re-sorts instantly.

Worked example

Pasting "banana", "apple", "cherry" (one per line) produces "apple", "banana", "cherry" — reordered alphabetically with nothing else changed about each line's content.

How the comparison works

Sorting uses JavaScript's `localeCompare`, which is locale-aware rather than a strict byte-by-byte comparison — it generally groups uppercase and lowercase versions of the same letter together instead of putting all capitals first.

How numbers and digits sort

Digits are compared as text characters, not as numeric values, so "10" can sort before "2" because the character "1" precedes "2" — this is standard alphabetical behavior, not a bug, but it means numeric lists may need a dedicated numeric sort instead.

Limitations

This tool only sorts ascending (A to Z); for descending order, sort here first and then reverse the resulting lines yourself or with a line-reversal tool. It doesn't deduplicate — repeated lines are kept and simply sorted next to each other.

Privacy

Sorting happens entirely in your browser — the list is never sent to a server.

Frequently Asked Questions

Is the sort case-sensitive?
Sorting uses locale-aware comparison, which generally groups uppercase and lowercase forms of the same letter together instead of a strict case-sensitive byte order.
Can I reverse the order to Z to A?
This tool sorts A to Z only; for descending order, sort here first and then reverse the resulting lines manually or with a text-reversal tool.
Does it handle numbers correctly?
Numbers are sorted as text characters, not as numeric values, so "10" can come before "2" — this matches standard alphabetical sort behavior.
Does it remove duplicate lines while sorting?
No, duplicates are kept and simply end up next to each other in the sorted result; use a dedicated deduplication tool first if you need them removed.