Free line sorter, A to Z
Sort lines alphabetically or in natural order
TextLab puts a pasted list into order as you type it: A to Z, Z to A, natural order where chapter2 comes before chapter10, by the number inside each line, or by length. It is free and unmetered — no account, and no ceiling on how many lines you throw at it. Capitals are ignored by default so Apple files beside apple, and ten alphabets are available for lists that are not in English.
- 100% free
- No signup
- Nine orders
- Ten alphabets
- Natural order for file2 and file10
How to sort lines alphabetically
Three steps, though the reordering itself happens the moment the lines land.
Paste the lines you want in order
A glossary, a bibliography, a class register, a list of filenames, a column lifted out of a spreadsheet — one entry per line. Blank lines are left out on the way in, and the counter tells you how many lines came through and whether they were already in the order you asked for.
Choose the order, then the alphabet
A to Z and Z to A are the ordinary ones. Natural order reads runs of digits as numbers, so chapter2 lands before chapter10 instead of after it. Numeric order sorts by the first number it finds in each line, which is the setting for prices, scores and quantities. Length and code point order are there for the jobs the others cannot do. The second menu picks the alphabet: Swedish files å, ä and ö after z, Czech treats ch as a letter of its own, and the German phone-book setting reads ä as ae.
Set the fiddly bits, then copy
Leave capitals ignored and Apple sits beside apple; tick the box and every capital is treated as a distinct letter. The other switches drop repeated lines, trim stray spaces before comparing, file The Great Gatsby under G rather than T, and ignore a bullet or a number at the start of a line so the sort looks at the words instead of the marker. Copy takes the sorted list, or save it as sorted-lines.txt.
Technical specifications
| Orders available | Nine: A to Z, Z to A, natural order both ways, by the number in the line both ways, by length both ways, and raw code point order |
|---|---|
| Alphabets | Ten, including Swedish (å, ä, ö after z), German phone book (ä as ae), Czech (ch after h), Turkish (dotless ı before i), Spanish (ñ after n) and French accent tie-breaking |
| How comparison works | Intl.Collator, the browser's implementation of the Unicode Collation Algorithm; ignoring capitals uses accent-level sensitivity, so apple and Apple match while café and cafe do not, and lines that compare equal keep the order they arrived in |
| Natural order | Numeric collation: runs of digits are read as values, so chapter2 precedes chapter10 and no leading zeros are needed |
| Numeric order | Sorts on the first number found in a line, understanding a minus sign, decimals and commas as thousands separators; lines holding no number wait at the bottom in their original order |
| Line preparation | Optional trimming, dropping of repeated lines, ignoring a leading The, A or An, and ignoring a bullet or number at the start of a line; blank lines are always left out |
| Capacity and speed | 50,000 lines are sorted in about 120 ms on a mid-range laptop, recalculated as you type, with no imposed limit |
| Price | Free, no signup, and the list is never uploaded to be sorted |
Frequently asked questions
How do I sort a list of lines alphabetically?
Paste the lines into the box and pick A to Z — the sorted list appears underneath straight away, with no button to press and no signup. Everything is optional after that: ignoring capitals is on by default, so a mixed-case list comes out the way a person would file it rather than with all the capitals bunched at the top.
Why did another tool put all the capitals first?
Because it sorted by character number instead of by alphabet. In the underlying character table every capital letter comes before every lowercase one — A is 65 and a is 97 — so a raw comparison files Zebra above apple and puts Smith between SMITH and smith. It is fast, it is what a programming language does by default, and it is almost never what a reader expects. This page uses proper collation instead, where a and A are the same letter at different strengths. The code point order setting is still available in the menu when you specifically want the raw version, and the strip under the box says which one you are looking at.
Why does file10 come before file2?
Because alphabetically it does: the comparison reaches the 1 and the 2 in the second position and 1 comes first, so nothing after that matters. This is correct alphabetical behaviour and almost never the desired one, which is why natural order exists — it spots runs of digits and compares them as numbers, so file2, file10 and file100 come out in the order a person would count them. Natural order is also what a file browser has been quietly doing since the mid-2000s, and it is the reason your downloads folder does not read 1, 10, 11, 2.
Can it sort names by surname?
Not from a list written first name first — no sorter can, because nothing in the text says which word is the surname. Van der Berg, Maria Teresa and Kim Min-jun each have a different answer, and a guess would be wrong often enough to be useless. Rewrite the lines as Surname, First before sorting, which is what a library catalogue does and what makes the result checkable; a spreadsheet or a find-and-replace pass will do the rewriting in bulk. Once the lines start with the surname the sort is ordinary alphabetical.
Do lines that are the same stay in the order I typed them?
Yes. When two lines compare as equal — which happens whenever capitals are being ignored, or two entries are genuinely identical — they come out in the order they went in, because the sort is stable and equal lines are settled by their original position. That guarantee has been part of the language standard since 2019 and it is what lets you sort twice to get a two-level order: sort by the secondary field first, then by the primary one, and the first sort survives inside each group of the second.
Does sorting get rid of duplicates?
Only if you tick the box, and then it keeps the first copy of each line and drops the rest, reporting the number removed in the strip under the counter. Whether Apple and apple count as duplicates depends on the capitals setting, so the two switches work together. Sorting is a good moment to deduplicate because repeats end up adjacent and become obvious, but the two operations are separate on purpose — plenty of lists need the repeats kept.
Why does the same list sort differently in Swedish?
Because å, ä and ö are letters in their own right at the end of the Swedish alphabet, not decorated versions of a and o. Sort Ängel in English and it files under A; sort it in Swedish and it comes after Zebra, which is what a Swedish reader will look for. The same divergence turns up all over: German telephone directories read ä as ae while ordinary German dictionaries file it under a, Czech treats ch as a single letter that follows h, Turkish keeps dotted and dotless i apart, and French breaks ties on accents by reading the word from the end. Ten alphabets are offered above, all supplied by the browser's own collation data.
Alphabetical order is not one order
Sorting looks like the least controversial operation in text handling until you try it on real data. The naive comparison — the one every programming language gives you free — compares the numbers assigned to characters, and in that table all 26 capitals sit before all 26 lowercase letters. Sorted that way, a list of surnames files every Adams and Zimmerman with a capital before any adams with a small one, and an accented letter lands somewhere past z entirely because its number is far higher. Nobody sorts a bibliography that way on paper. What people mean by alphabetical is collation: a set of rules that says a and A are the same letter at different strengths, that é is an e with something added, and that the difference only breaks a tie when everything else is equal. Unicode publishes those rules as the Unicode Collation Algorithm, the tailoring data lives in CLDR, and every browser ships an implementation of it — which is why this page needs no dictionary download to sort a Czech glossary.
The rules are not the same everywhere, and this is where sorting stops being a technical detail and starts being a matter of getting it right for a reader. In Swedish, å, ä and ö are three separate letters at the end of the alphabet, so Ängel belongs after Zebra; in German they are variants of a and o and belong beside them — except in a telephone directory, where ä has traditionally been read as ae. Czech treats ch as a single letter filed after h, so Chomutov comes after Humpolec. Spanish moved ch and ll out of the alphabet in 1994 but kept ñ as its own letter after n. Turkish keeps dotted and dotless i apart. French, uniquely, resolves ties on accents by comparing from the end of the word rather than the start, so cote, côte, coté and côté come out in that order. Choose the alphabet that matches your readers, not the one that matches your keyboard.
The other everyday surprise is the one filenames cause. Alphabetically, chapter10 really does come before chapter2 — the comparison reaches the 1 and the 2 and stops — and that answer is technically correct and practically useless. Natural order fixes it by reading each run of digits as a number, which is what a file browser has quietly done for two decades; the alternative is to pad the numbers with leading zeros until counting order and text order stop disagreeing, which the numbered list generator will do for you. Sorting is also the moment repeats become visible, since they land next to each other — the tick box here removes them, and remove duplicate lines does the same job on a list you would rather leave in its original order. And when the order you want is no order at all, the list randomizer is next door.
Nothing to upload to sort a list
A register of pupils, a customer list or an unpublished index is sorted where it sits, by the browser you are reading this in. The collation data the sort needs already ships inside that browser, so even switching to the Czech or Turkish alphabet fetches nothing and reveals nothing — no request leaves the page, and none of your lines is stored. Close the tab and the list is gone, with nothing waiting for you next time.