About Sort Lines A-Z
Sort Lines A-Z puts the lines of a block of text in alphabetical order, from the first to the last. It is the standard way to turn a jumbled list into a canonical one so that two lists can be compared, to bring a set of names into a readable order, or to put configuration entries into a predictable sequence.
The comparison is locale-aware rather than a raw character-by-character ordering, which is what makes the result look right to a reader. Accented characters sort next to their unaccented counterparts instead of being pushed to the end, and case does not split otherwise identical words into two distant groups — both of which happen when sorting is done on character codes alone.
Line content is taken exactly as written and only the order changes. Leading whitespace, punctuation and trailing spaces all travel with their line, so indented entries keep their indentation and a list that was not uniformly formatted will sort in a way that reflects those differences. Blank lines have no content and therefore sort to the front.
How to use Sort Lines A-Z
- 1 Paste the list, one entry per line.
- 2 Read the output, with the lines in ascending alphabetical order.
- 3 Check whether any entries had leading whitespace, since that affects where they land.
Frequently asked questions
Are capitalised entries sorted separately from lowercase ones?
No. Locale-aware comparison treats a leading capital as equivalent for ordering purposes, so an uppercase term lands next to its lowercase equivalent rather than jumping to the top of the list. A character-code sort would group them apart.
Why is my blank line at the top?
Because an empty line has no characters and therefore sorts before any line with content. If the blank lines are not wanted, remove them from the input before sorting.
Does it sort by the whole line or just the first word?
By the whole line, compared as text. Where lines begin with a number the ordering will be character-based rather than numeric, so a list of numbered items may not come out in counting order.
Are duplicate lines removed?
No, duplicates are kept, and they end up adjacent because identical lines compare equal. That adjacency is often exactly what you want when the goal is to spot repeats before deduplicating them.
Free, online, and private
Free to use
Sort Lines A-Z is completely free. There is no account to create, no login, and no hidden charge or usage limit.
Runs online in your browser
It is a free online tool that runs entirely in your browser. Nothing to download or install — open the page and start using it right away.
Your data stays private
All processing happens locally on your device. Your input is never uploaded, stored, or tracked, so it never leaves your browser.
How Sort Lines A-Z behaves in detail
These are the specifics of this implementation — the exact ranges, defaults and fixed settings you are working with.
| Parameter | Value |
|---|---|
| Line splitting | on the pattern \r?\n, so CRLF and LF input both split correctly; the output is joined with LF |
| Comparison | whole lines compared pairwise with localeCompare, using whatever default locale the runtime provides |
| Blank lines | kept as empty strings and sorted along with the rest, which places them at the top |
| Equal lines | keep their input order — the sort is stable, so duplicates do not shuffle |
| Update mode | live — recomputed on every keystroke |
Compiled from the implementation of this tool and checked against it by itoolnet.
What Sort Lines A-Z does not do
Knowing the edges of a tool saves more time than another list of its features. These are the cases where it will not do what you might expect.
- Blank lines and a trailing newline take part in the comparison. An empty string sorts before any text, so a list that ends with a newline comes back with an empty first line instead of leaving that newline at the end where it started.
- Each line is compared as a whole raw string with no trimming and no case folding first. Leading spaces are significant to the collation, so an indented line sorts before the same line without its indent, and there is no way to sort by a column or by a field further along the line.
- The order comes from the machine, not from the data. No locale is passed and no numeric or sensitivity option is set, so numeric runs are compared as text — "10" lands before "9" — and the relative order of accented and uppercase lines can differ between browsers and operating systems.
Tested and documented by itoolnet, the team that builds and maintains this site.