Sort Lines Alphabetically

Put any list in alphabetical order (A-Z or Z-A), by length, reversed or shuffled. Perfect for organizing names, items and data.

What this tool does

Sort Lines reorders the lines of any list according to the rule you choose — alphabetically, by length, reversed, or shuffled into random order. Paste a list of names, items, URLs or data and reorganize it in one click, instead of cutting and pasting rows by hand. Each line is treated as a separate item.

The sorting options

A to Z sorts alphabetically, the standard for names and word lists. Z to A reverses that. Sort by length, short to long or long to short, is useful when you want to group brief entries together or find the outliers. Reverse simply flips the current order without re-sorting. Shuffle randomizes the order, handy for picking a random sequence, randomizing a quiz, or breaking an unwanted pattern.

Common uses

Writers and editors alphabetize glossaries, reference lists and indexes. Developers sort lists of keys, imports or config values. Teachers shuffle a list of names to call on students randomly or randomize question order. Anyone organizing data — a list of products, cities, tags or categories — gets it into a predictable order instantly. Pair it with the Remove Duplicate Lines tool to clean and sort a list in two quick steps.

How sorting handles case and numbers

Alphabetical sorting uses your browser's locale-aware comparison, so accented characters and international letters sort sensibly rather than being dumped at the end. Numbers within text sort by their character value, which means "item2" and "item10" may not land in numeric order — a known quirk of text sorting that affects every tool of this kind. For purely numeric lists, sorting by length often gives the grouping you actually want.

What sorting lines is for

Sorting puts a list into a predictable order so it is easier to scan, compare and use. Alphabetize a list of names for a roster, order a glossary of terms, arrange file names, or put a bibliography into order. Reverse the sort to go Z to A. Sort by length to group short and long entries. Shuffle to randomize the order for a draw or a randomized test. A sorted list is faster to search by eye and easier to spot gaps or duplicates in.

Alphabetical, length and reverse order

TextCaret offers several orders so you can pick the one your task needs. A to Z is the standard alphabetical sort, treating the list case-insensitively so capitalization does not scatter related entries. Z to A reverses it. Sorting by length, ascending or descending, groups lines by how many characters they contain, which is handy for spotting outliers or organizing by size. Reverse simply flips the current order without re-sorting. Shuffle randomizes — useful for picking a random order or building randomized test data.

Sort and de-duplicate together

Sorting and removing duplicates are often two halves of the same cleanup job. A common workflow is to remove duplicate lines first, then sort the unique result into alphabetical order — exactly what you want when preparing a clean reference list, a sorted set of keywords or a tidy glossary. Use the Remove Duplicate Lines tool, copy the result, then sort it here. Both run entirely in your browser, so even sensitive lists stay on your machine through the whole process.

Frequently asked questions

Can I sort a list alphabetically and remove duplicates at once?
Sort here, then run the result through the Remove Duplicate Lines tool — or de-duplicate first, then sort. Two quick steps give you a clean, ordered list.
Does it sort numbers correctly?
Text sorting compares character by character, so "item10" can come before "item2." This is standard behavior for line-based text sorting. For numeric grouping, sorting by length sometimes gives a more useful result.
What does shuffle do?
Shuffle randomizes the order of all lines. It is useful for randomizing names, quiz questions, or any list where you want an unpredictable sequence.
Are accented and non-English characters sorted properly?
Yes. The tool uses locale-aware comparison, so accented letters and international characters sort in a sensible order rather than being pushed to the end.
Is my list private?
Yes. Sorting happens entirely in your browser. Nothing is uploaded or stored.
Does the sort treat uppercase and lowercase differently?
The A to Z and Z to A sorts are case-insensitive, so "apple" and "Apple" group together naturally rather than being separated. This matches how most people expect an alphabetical list to read.
Can I sort numbers?
Lines are sorted as text, so numbers sort by their characters (1, 10, 2) rather than numerically. For purely numeric lists, padding numbers to the same width first gives a numeric-looking order.
What does sort by length do?
It orders lines by how many characters each contains, shortest to longest or the reverse. This is useful for grouping entries by size or finding unusually long or short lines.
Will sorting remove duplicates too?
No, sorting only reorders. To remove repeats, use the Remove Duplicate Lines tool first, then sort the clean result here.