Sort Text Lines
Sort lines of text alphabetically, numerically, by length, or randomly - with dedupe and empty-line removal.
- Free, no account
- No watermark
- No usage limit
About the Sort Text Lines
Most days you don't need a list sorted so much as you need it cleaned up. It came out of three different exports, a chunk of the lines are duplicates, there are blank rows the spreadsheet left in, and the order is a mess. Sort Text Lines handles the whole thing in one go. You pick an order and it sorts the lines, drops the duplicate ones, and clears the blanks all at the same time, redrawing the result the instant you touch anything. There's no sort button to go looking for. Choose a mode, the output changes.
And the whole thing runs on your own machine. A lot of the free line sorters only alphabetize, so you paste into one site to sort, a second to dedupe, a third to clear the blank rows, and back again. Some of them quietly send your list to a server to do the work, which is a rotten trade when what you're sorting is a client roster or an internal inventory nobody outside should see. This one never sends your text anywhere. Load the page, pull your network cable, and it keeps sorting. There's no server in the loop, so there's nowhere for your list to leak to.
Seven orders cover most of what you'd ask for: A to Z, Z to A, numeric up or down, by length, plain reverse, and a shuffle, and there are three toggles alongside them for the cleanup.
How to use
- Paste your lines into the top box, one item per line. Names, emails, filenames, log lines, keywords, CSV rows, code, a to-do list, whatever's organized into lines. Straight from a spreadsheet or a terminal is fine.
- Pick an order. A to Z, Z to A, Numeric ascending or descending, By length, Reverse, or Shuffle. The result updates the moment you click, so you can flip between them and watch what each one does before you commit.
- Turn on the cleanup you want. Case-insensitive matching (on by default), remove duplicate lines, remove empty lines. They stack, so a single paste can be deduped, blank-stripped, and alphabetized in one shot.
- Copy the result, or hit Clear and start fresh. Nothing is saved and nothing is destructive, so poke at it until the output looks right.
The numbers are the part people get wrong
Alphabetical sorting compares text one character at a time, left to right, which is fine for words and falls apart on numbers. Feed a plain A to Z sort a list like this:
2
10
3
100
and you get 10, 100, 2, 3 back, because the sort compares the character 1 against the character 2, sees that 1 comes first, and stops there without ever reading 10 as ten. To an alphabetical sort those are just two characters that happen to look like a number.
Numeric mode fixes it. Switch to it and the tool reads the value at the front of each line and orders by the actual number, so you get 2, 3, 10, 100, the way you meant. Use it for price lists, quantities, scores, ranked rows, anything where the digits carry the meaning. Descending flips it for a top-down leaderboard.
Numeric mode keys off the number at the START of the line, and that's its one catch. A bare 2 or a 10.99 Widget sorts by value because the number leads. A line like Item 10 or v1.2 starts with letters, so numeric mode can't find a leading value and parks those lines out of the way, at the end when you sort ascending. If your numbers sit at the front, it just works. If they're buried mid-line, move them up front or the sort has nothing to grab onto.
Commas inside a number are read as thousands separators, so 1,200 sorts as twelve hundred and not as a lonely 1. That matters more than it sounds like it should. The quick way to pull a value off a line is to read digits from the left and stop at the first character that isn't one, and in 1,200 the first character that isn't one is the comma, so the line ends up worth 1 and 12,500 ends up worth 12. Nothing about that looks broken from the outside, because a price column pasted straight out of a spreadsheet comes back in an order that reads as deliberate right up until you check it. Grouping here is the American way round, commas between the thousands and a period for the decimal, so 12,500.75 is twelve and a half thousand. If your numbers come the other way, written 12.500,75, convert them before you paste, because there's no telling a 1.200 that means twelve hundred from a 1.200 that means one point two. A currency symbol out front still stops the read cold, so $1,200 drops to the end with the rest of the non-numbers. Strip the $ column first if your export carries one.
Sort and clean in the same pass
The three toggles are where a messy paste actually gets tidy.
Remove duplicate lines keeps the first time a line shows up and deletes every repeat after it. This is the quick way to collapse a merged export, or a keyword dump where the same term got pasted twice. Sorting alphabetically at the same time drags identical lines right next to each other, so you can eyeball the repeats before they're cut, though the dedupe does its job no matter which order you sort in.
Remove empty lines clears the blank rows, including the ones that only look empty because they hold a stray space or a tab. Data copied out of a PDF or a spreadsheet is full of these, and they quietly wreck an otherwise clean list.
Case-insensitive matching is on by default, and it pulls double duty. It treats Apple and apple as the same while it sorts, and it treats them as the same line while it dedupes, so a mailing list where both Email and email slipped in collapses down to one. Turn it off when capitalization is meaningful, like sorting code identifiers where MyClass and myField genuinely are different names.
The other three modes are quick. By length orders shortest to longest, useful for spotting the one absurdly long URL in a batch. Reverse flips the order of your lines without sorting them at all, purely positional, which is not the same as Z to A. Shuffle is the un-sort, a random reorder for pulling a giveaway winner or scrambling a question bank, and every click hands you a fresh draw.
Frequently asked questions
Does sorting change the text inside each line?
No. It only reorders whole lines and removes the ones you asked it to. It never touches the characters inside a line, so a 007 stays 007, a 3-4 stays 3-4, and leading zeros survive intact. That's the main reason to reach for this over a spreadsheet, which loves to "help" by reading 007 as 7 or turning 3-4 into a date.
How does Numeric mode handle negatives and decimals?
By value, same as whole numbers. A column of -40, -3.5, 0, 2.75, 19 comes back in exactly that order, and a price list mixing 9.99 with 12 sorts the way money actually goes, not 12 ahead of 9.99 the way a plain A to Z would leave it. Ascending runs low to high, descending high to low. Anything that opens with a digit, a minus sign, or a decimal point gets read as a number, so 5kg counts as 5, while kg5 starts with a letter and drops out of the numeric order.
I removed duplicates but some repeats survived. What happened?
Almost always trailing whitespace. Two lines count as duplicates only when they match exactly, and a stray space or tab on the end of one makes it a different line from its twin even though they look identical on screen. Remove empty lines won't catch these either, since they aren't blank. Trim the trailing whitespace first, then dedupe.
Can I sort by the second or third column?
Not directly. This sorts whole lines, so a multi-column row gets ordered by whatever leads it, the first column. To order by a later column, pull that column out into its own list, sort it here, and reassemble, or use a spreadsheet when you need true in-place column sorting. For sorting by the first column, though, paste and go.
What's the difference between Reverse and Z to A?
Reverse just flips the current order top to bottom without alphabetizing anything, so the last line becomes the first. Z to A actually sorts, running backward through the alphabet. They only land on the same result when your list was already in A to Z order to start with. Reach for Reverse when your lines are already in some meaningful order, like time order, and you want them upside down.
Does it handle accented or non-English text?
Yes. It uses your browser's own language-aware comparison, so café sorts next to cafe instead of getting dumped at the bottom the way a raw byte-order sort would treat it. Accented letters land roughly where a reader expects them, not off in their own pile.
How many lines can I sort at once?
There's no fixed cap. Because the work happens on your device, the only ceiling is your own memory, and a normal list of a few thousand lines sorts in an eyeblink. Paste something genuinely huge and the only thing that slows it down is your own machine, since there is no upload and no queue on someone else's server.