TEXT TOOL

Alphabetize List: Sort Lines A to Z

Paste a list and sort it A–Z, Z–A, in natural order (file2 before file10), by number, by length, or shuffled. Nothing is uploaded.

About this tool

Sorting a list by hand is slow and easy to get wrong, and spreadsheet sorting drags in columns, headers and formatting you don't want. This sorter works on plain lines of text: paste a list, pick an order, and copy the result. It runs entirely in your browser, so a customer list, a set of keywords or a pile of file names never leaves your device.

How to use the Text Sorter

  1. Paste your list with one item per line. Copying a single column out of a spreadsheet gives you exactly that.
  2. Choose a sort order. Alphabetical is the usual choice; natural order is better for anything with numbers inside it.
  3. Set the clean-up options — ignore case, drop blank lines, trim stray spaces, remove duplicates, or ignore a leading "The", "A" or "An".
  4. Click Sort lines, then copy the result or download it as a .txt file.

The sort orders, explained

Every sort is stable: when two lines compare as equal (for example "Apple" and "apple" with Ignore case on), they stay in the order you pasted them.

Worked example

Say you paste these five file names: file10.txt, File1.txt, file2.txt, file1.txt and a blank line. With Alphabetical and Ignore case on, the blank line is dropped and you get File1.txt, file1.txt, file10.txt, file2.txt — "file10" lands before "file2", which is rarely what you want. Switch to Natural order and the result becomes File1.txt, file1.txt, file2.txt, file10.txt. Tick Remove duplicates as well and, because case is being ignored, file1.txt is treated as a repeat of File1.txt and removed, leaving three lines. The first spelling you pasted is the one that's kept.

Ignoring "The", "A" and "An"

Libraries and music apps file "The Beatles" under B, not T. Tick Ignore leading "The", "A", "An" and the sorter does the same: it skips one leading article (followed by a space) when comparing lines, but leaves the text itself untouched, so "The Beatles" still appears exactly as you typed it — just in the B section. This only applies to English articles at the very start of a line.

Common use cases

Things to watch out for

The sorter treats each line as one item, so a list separated by commas needs to be split onto separate lines first — the Find & Replace tool can swap ", " for a line break. Numeric sorting only looks at the first number in a line, so "Room 2, floor 10" sorts as 2. And "Remove duplicates" means an exact match after trimming and case options are applied; two entries that mean the same thing but are spelled differently won't be merged. If de-duplication is all you need, the Duplicate Line Remover keeps your original order instead of sorting.

Why "Zebra" can sort before "apple" in other tools

Computers store each character as a number (its Unicode code point), and the simplest sort just compares those numbers. Capital letters A to Z are 65 to 90 and lowercase a to z are 97 to 122, so a plain code-point sort puts every capitalized word first: Zebra, apple, banana. Accented letters have even higher numbers, so Éclair ends up after banana. Digits (48 to 57) come before letters, and they are compared one at a time, so 10 items sorts before 9 items.

This sorter uses the browser's Intl.Collator, the language-aware comparison defined in the ECMAScript Internationalization API, which gives apple, banana, Éclair, Zebra. Natural order turns on the collator's numeric option, so runs of digits compare as whole numbers.

Number formats in numeric sort

Numeric value sorting reads the first number in each line and understands minus signs, decimal points and comma thousands separators, so 1,200.50 is read as 1200.5. Two formats don't work as expected:

Doing the same on the command line

If you work in a terminal, GNU sort covers most of these modes:

GNU sort is also locale-aware; run it as LC_ALL=C sort to get the plain code-point order described above. To remove repeats without changing the order, use the Duplicate Line Remover.

Frequently asked questions

Why does file10 come before file2 when I sort alphabetically?

Alphabetical sorting compares text one character at a time, and "1" comes before "2", so "file10" is placed first. Choose Natural order to compare whole numbers inside the text, which puts file2 before file10.

Does the sorter keep capital and lowercase letters together?

Yes. It uses language-aware comparison, so "apple" and "Apple" sort next to each other. With Ignore case on they are treated as equal and keep the order you pasted them in.

Can I sort and remove duplicates at the same time?

Yes. Tick Remove duplicates and repeated lines are removed as the list is sorted. The first occurrence is kept, and with Ignore case on, lines that differ only in capitalisation count as duplicates.

How does numeric sorting handle lines without a number?

Lines with no number are placed after all the numbered lines, in the same order they appeared in your list.

Is the random shuffle really random?

It uses a Fisher–Yates shuffle driven by the browser's cryptographic random number generator, so every possible ordering of your list is equally likely.

How do I sort a list alphabetically and ignore capital letters?

Paste the list, choose Alphabetical (A → Z) and tick Ignore case. Lines are then compared by their letters alone, so apple and Apple are treated as equal and keep the order you pasted them in. Without the option, they still sit together rather than all capitals jumping to the top.

Can I sort dates with this tool?

Dates written as YYYY-MM-DD, such as 2026-09-30, sort correctly with plain alphabetical order, because the year comes first and each part has a fixed width. Formats like 12/03/2026 do not sort chronologically, since the tool compares them by their first number or first characters.