Sort Lines Alphabetically

Runs 100% in your browser — nothing you paste is uploaded or stored.

What "natural" number sorting means

Sort a list of file names or product SKUs the plain way and you'll almost always see something odd: "item10" lands ahead of "item2", and "page11" beats "page9" to the top. This isn't a bug — it's exactly what a character-by-character comparison is supposed to do. A standard sort reads each line one character at a time, like words in a dictionary. "item10" and "item2" match up through "item", and then the comparison hits "1" versus "2". Since the character "1" comes before the character "2", "item10" is judged to come first — the sort never gets far enough to notice that "10" as a whole number is bigger than "2". Natural number sorting, sometimes called numeric collation, fixes this by recognizing runs of digits as complete numbers and comparing their numeric value instead of comparing them digit by digit. With that turned on, "item2" correctly sorts before "item10" and "page9" comes before "page11". This tool's Natural number order checkbox, on by default, is exactly this feature — flip it off only if you specifically need the old character-by-character behavior, since for almost any real list of names, files, or references, leaving it on gives you the ordering people actually mean by a sorted list.

How to alphabetize a list

Paste your list into the box on the left, one item per line. The alphabetized result appears in the box on the right instantly, with no button to click and no page to reload. Pick A → Z or Z → A above the boxes to alphabetize a list in either direction, and toggle the numeric and case options to match what you're sorting — every change recalculates the output immediately using whatever text currently sits in the input box. Blank lines are treated like any other line and sort to the very top in ascending order, since an empty line is considered to come before anything with actual characters in it; switch to descending and they land at the bottom instead. When the result looks right, click Copy to grab it in one step, or Clear to wipe the input and start over with a fresh paste. Everything runs locally in your browser using plain JavaScript — nothing you type or paste is ever uploaded, logged, or sent to a server — which makes this a reasonable alphabetical order tool even for lists of names or emails you'd rather not run through a random website.

Sorting options explained

Three controls decide exactly how your list gets ordered. The A → Z / Z → A radio buttons pick the direction — descending is simply the ascending result reversed, so whatever comes first going up comes last going down, blank lines included. Natural number order, described above, controls whether embedded numbers compare by value ("item2" before "item10") or character by character ("item10" before "item2"); it's on by default because it matches what most people expect from a sort list az tool. Case sensitive, off by default, decides whether uppercase and lowercase letters are treated as different characters. With it off, "apple" and "Apple" are treated as equal for sorting purposes, and since JavaScript's sort keeps equal items in their original relative order, whichever spelling appeared first in your pasted list still appears first in the output. Turn Case sensitive on and the two are compared as distinct strings, so capitalization affects where each one lands. Under the hood, all of this runs through the browser's built-in English collator, which is also why accented letters sort where an English reader expects them rather than at the very end of the alphabet — more on that in the FAQ below.

Common uses: names, references, keywords

A sort lines alphabetically tool earns its keep on ordinary, recurring lists. Contact names exported from a spreadsheet sort cleanly with case sensitivity off, since "mcdonald" and "McDonald" end up next to each other rather than split apart by capitalization. Bibliography or citation lists alphabetize by author surname the same way a printed reference list would, once each line starts with the right word. Keyword research lists pulled from several tools line up so duplicates and near-duplicates sit next to each other, making exact repeats easier to spot afterward. File and version lists — build numbers, chapter files, invoice numbers — are exactly where natural number order matters most, since "invoice9" and "invoice10" only line up correctly when the digits are compared as numbers rather than as individual characters. In every case the workflow is the same: paste the list, pick a direction and the two checkboxes that match what you're sorting, and copy the result back out.

Frequently asked questions

Why does item10 come before item2 in normal sorts?

A plain sort compares text character by character, like words in a dictionary. "item10" and "item2" match up through "item", and then the comparison reaches "1" versus "2" — since the character "1" comes before the character "2", "item10" is judged to come first. The sort never looks at "10" and "2" as whole numbers. Turning on this tool's "Natural number order" option fixes that by comparing runs of digits by their numeric value instead, so "item2" correctly sorts before "item10".

Does sorting remove duplicates too?

No — sorting only reorders your lines; it never deletes anything. Identical lines end up sitting right next to each other after sorting, which makes them easy to spot, but they're still all there in the output. If you actually want repeats removed, run your list through the Duplicate Line Remover tool, either before or after sorting.

How are accented characters ordered?

This tool sorts using English-locale collation, which orders accented letters the way an English reader would expect — "é" sorts right next to "e", not off at the end of the alphabet after "z". That's different from a raw code-point sort (the kind you'd get from comparing raw Unicode values), which would push many accented characters well past plain ASCII letters. Locale-aware sorting keeps a name like "Émile" sitting near other E names instead of at the bottom of the list.

Can I sort a comma-separated list?

Not directly — this tool sorts lines, one item per line break, not comma-separated values. If your list is written as "apple, banana, cherry" on one line, first convert the commas to line breaks (the Find and Replace tool at /find-and-replace/ can do this), paste the result here to sort it, and then convert the line breaks back to commas afterward if you need the original format back.