Free Text Sorter

Sort any list alphabetically, naturally, by number, or by length, or reverse and shuffle it, right in your browser.

Sorted in your browser. Your text is never uploaded or stored.

0
Input lines
0
Output lines
0
Duplicates removed
0
Empty lines removed
Advertisement

How to Use the Text Sorter

Paste your list into the left box with one item per line, then pick a sort order from the row of buttons. The sorted result appears on the right instantly and keeps updating as you edit the list or toggle an option. The four checkboxes control how lines are prepared before sorting: ignore capitalization, trim stray spaces from the ends of each line, drop blank lines, and remove duplicate entries. When the result looks right, copy it, download it as a text file, or move it back into the input box to apply another pass.

Shuffle is the one mode that does not re-run on every keystroke, since a list that reshuffles while you type is not much use. Click Shuffle again whenever you want a fresh random order. The status line under the buttons summarizes what the last run did, which helps when you are working with lists too long to check by eye.

Alphabetical, Natural, and Numeric: Picking the Right Order

A → Z and Z → A compare lines character by character using the ordering rules of your browser's language. That handles accented letters sensibly, so "école" sorts next to "ecology" instead of after "zebra", and it is the right choice for names, words, titles, and most everyday lists.

Pure alphabetical order goes wrong as soon as numbers are embedded in text. Because "1" comes before "2", a character-by-character sort produces file1, file10, file11, file2. Natural sort fixes this by reading each run of digits as a whole number, giving file1, file2, file10, file11. Use it for file names, chapter and episode titles, version labels like "v2.9" and "v2.10", street addresses, and anything else a person numbered by hand.

Numeric value is for lists where the number is the point: prices, scores, measurements, or totals copied from a report. It finds the first number in each line, understands negative signs, decimals, and comma thousands separators such as $1,250.75, and orders lines strictly by that value from smallest to largest. Lines that contain no number at all are moved to the end in alphabetical order instead of being scattered through the result. Natural sort is not a substitute here: it reads "3.14" as the integers 3 and 14, so it would place 3.14 after 3.9.

Advertisement

Why Computers Sometimes Sort "Wrong"

Every character has a numeric code, and the simplest way for software to sort is to compare those codes. In ASCII and Unicode, all capital letters come before all lowercase letters, so a raw code sort puts "Zebra" ahead of "apple", and accented letters land after "z" entirely. Many programming languages, databases, and command-line tools sort this way by default, which is why lists exported from different systems can come back in different orders.

This tool uses locale-aware collation instead, the same machinery browsers use for language-sensitive comparisons. With Case-insensitive on, "apple", "Apple", and "APPLE" are treated as equal and keep the relative order they had in your input; this is what most people expect from an alphabetical list. With it off, words are still grouped alphabetically, but when two lines differ only in capitalization the capitalized version comes first. Case sensitivity also affects the duplicate filter: with case-insensitive on, "Paris" and "paris" count as the same entry and only the first is kept.

The preparation options always run in a fixed order before any sorting happens: whitespace is trimmed first, then blank lines are dropped, then duplicates are removed, and only then is the remaining list ordered. That sequence matters. Trimming first means "apple" and "apple " are recognized as the same entry, and removing blanks first keeps a cluster of empty lines from piling up at the top of an A → Z result, since an empty line sorts before every letter. If you deliberately want blank lines preserved, for example as separators you plan to remove later, untick "Remove empty lines" and they will gather at the start of an ascending sort or the end of a descending one.

Sorting by Length, Reversing, and Shuffling

Length sorting orders lines by how many characters they contain, counting each emoji or accented letter as one character, the way it appears on screen. Lines of equal length are ordered alphabetically so the result is predictable. It is handy for spotting outliers such as truncated entries or pasted paragraphs in a list of short codes, for finding the longest title that must fit a layout, and for building word lists for puzzles and games.

Reverse order simply flips the list upside down without comparing anything, which is useful for turning a newest-last log into newest-first or undoing a sort in the wrong direction. Shuffle uses the Fisher-Yates algorithm: it walks backward through the list and swaps each line with a randomly chosen line at or before it. With an unbiased random source, every possible ordering is equally likely. The random numbers come from your browser's cryptographic generator, not the weaker general-purpose one, so the result is suitable for choosing speaking order, assigning reviewers, randomizing flashcards, or picking a winner for an informal giveaway.

Everyday Uses

Common jobs include alphabetizing a guest list, bibliography, glossary, or list of team members; putting a column of numbers copied from a PDF into ascending order to find the median or the outliers; tidying configuration files and dependency lists so changes are easy to review; ordering file names naturally before a batch rename; and building a deduplicated, sorted keyword list for SEO or advertising work. Teachers use shuffle to randomize quiz questions or presentation order. Combined with the "Remove duplicates" option, a single pass turns a messy pasted list into a clean, ordered, unique set. If you only want duplicates removed while keeping the original order, use the Duplicate Line Remover instead.

Sorting Elsewhere: Spreadsheets and the Command Line

Excel and Google Sheets sort columns with Sort A to Z and Sort Z to A, and Google Sheets' SORT() formula produces a live sorted copy. Spreadsheets sort numbers stored as numbers by value, but numbers stored as text sort alphabetically, which is a common source of confusion with imported data.

On Linux and macOS, sort sorts alphabetically according to the current locale, sort -f ignores case, sort -n sorts numerically, sort -r reverses, and sort -u removes duplicates. GNU sort -V provides version-aware ordering similar to natural sort. For a random order, shuf is the right tool; sort -R also randomizes, but it groups identical lines together. A browser tool is quicker for one-off lists and does not depend on how a particular machine's locale is configured.

Frequently Asked Questions

Why does file10 come before file2 when I sort A–Z?

Alphabetical sorting compares text one character at a time, and the character 1 comes before 2, so file10 lands ahead of file2. Natural sort reads runs of digits as whole numbers, which puts file2 before file10. Use Natural for file names, version numbers, and numbered items.

What is the difference between Natural and Numeric sorting?

Natural sort treats each run of digits as an integer while keeping the surrounding text in alphabetical order, which suits labels like Chapter 9 and Chapter 12. Numeric sort finds the first number in each line, including negatives, decimals, and thousands separators, and orders lines strictly by that value. Lines without a number go to the end.

Does the shuffle produce a truly random order?

It uses the Fisher-Yates algorithm with random numbers from your browser's cryptographic generator, so every possible order is equally likely. That is suitable for picking presentation order, assigning tasks, or randomizing a study list. For legally regulated drawings, follow the rules and auditing requirements that apply to you.

Why do uppercase words sort before lowercase ones in some programs?

Many programs sort by raw character codes, and in ASCII and Unicode every capital letter has a lower code than every lowercase letter, so Zebra comes before apple. This tool uses language-aware ordering instead. With case-insensitive on, capitalization is ignored; with it off, words are still alphabetical and the capitalized form comes first when two words differ only in case.

Is my text uploaded when I sort it?

No. Sorting happens entirely in your browser using JavaScript. Nothing you paste is sent to a server or saved, so you can safely sort internal lists, names, or IDs.

Advertisement

Related Articles

Expert guides and educational resources to help you master the math.

Related Tools

More free text utilities to help with your writing.