Sort Text Lines
Sort any list of text lines alphabetically, in reverse, or numerically, with case and duplicate options. Paste, sort, copy. No signup. Ideal for lists, data cleanup and CSV prep.
Result
| Sorted Lines |
|---|
Share on Social Media:
This tool sorts lines of text alphabetically, in reverse order, or numerically, directly in your browser. Paste your list, choose the sort type and options such as case sensitivity, and copy the ordered result. No account, no app, and no install, so you can tidy any list of names, items or data on any device in seconds.
How to Sort Text Lines Step by Step
- Paste your lines. Drop your list into the input box, one item per line. It can be names, filenames, numbers, tasks, or any text where each line is a separate entry to be ordered.
- Choose the sort direction. Select ascending for A to Z or smallest to largest, or descending for Z to A or largest to smallest, depending on how you want the list ordered.
- Pick alphabetical or numeric. Use alphabetical for words and mixed text. Switch to numeric when your lines are numbers, so that ten sorts after nine rather than between one and two.
- Set case and duplicate options. Decide whether uppercase and lowercase should be treated the same, and whether to remove duplicate lines as part of the sort for a clean, deduplicated list.
- Copy the sorted result. The ordered lines appear in the output. Copy them back into your document, spreadsheet or code with a single click, ready to use.

How Text Sorting Works and Why Order Rules Matter
Sorting text seems trivial until you meet the rules that govern it. The default is lexicographic order, which compares strings character by character using each character underlying code value. Because uppercase letters have lower code values than lowercase in the standard ASCII and Unicode ordering, a naive sort places all capitalised words before any lowercase ones, so Zebra can sort before apple. This surprises people who expect a human dictionary order, and it is why a case insensitivity option exists.
The gap between alphabetical and numeric sorting causes the most confusion. Sorted as text, the numbers one, two and ten order as one, ten, two, because the character one comes before the character two and lexicographic comparison looks at the first character first. Sorted numerically, they correctly order one, two, ten. This is not a bug, it is the difference between comparing strings and comparing values, and choosing the right mode is essential when your lines are numbers.
Natural sort order is a refinement that tries to match human expectations for mixed text and numbers, so that file2 comes before file10 rather than after it. Pure lexicographic sorting places file10 before file2 because the character one precedes the character two. Natural sorting detects the numeric portions and compares them as values, which is why operating systems adopted it for file listings. It matters whenever your lines mix words and numbers, such as versioned filenames.
Deduplication frequently accompanies sorting because the two operations solve related problems. Sorting groups identical lines together, which makes duplicates adjacent and therefore easy to remove in a single pass. Combining sort and deduplicate produces a clean, ordered, unique list, which is exactly what is needed when merging several lists, tidying a set of tags, or preparing a column of values for import into a database or spreadsheet without repeats.
Online Sorter Versus Spreadsheet or Command Line
| Method | Strengths | Weaknesses | Best for |
|---|---|---|---|
| This online tool | Instant, no install, case and numeric options, deduplicate built in | Handles one list at a time, not linked to a data source | Quick one off sorting of any pasted list |
| Spreadsheet sort | Sorts alongside related columns, part of a larger workflow | Slower to set up for a single column, overkill for a plain list | Data that lives in rows with multiple fields |
| Command line sort | Scriptable, handles huge files, automatable | Requires terminal knowledge, syntax for numeric and case options | Developers processing large files in a pipeline |
| Manual reordering | No tools needed for a tiny list | Error prone and painfully slow beyond a handful of lines | Three or four lines you can eyeball |
Who Needs to Sort Lines of Text

Pro Tips for Clean, Correct Sorting
Common Text Sorting Mistakes to Avoid
Related Tools You May Need Next
To clean a list before sorting, our Remove Duplicate Lines and Whitespace Remover tidy the input. After sorting, the Line Counter confirms how many entries you have, and the Reverse List flips the order without a full re sort.

Frequently Asked Questions
How do I sort a list of text lines alphabetically?
Paste your list into the input box with one item per line, choose alphabetical mode and ascending direction for A to Z, then copy the sorted output. For human readable lists, enable the case insensitive option so capitalised and lowercase words sort together as they would in a dictionary, rather than all capitals appearing before all lowercase words.
Why do my numbers sort in the wrong order?
You are most likely sorting them as text rather than as numbers. In text mode the tool compares character by character, so ten sorts before two because the character one precedes the character two. Switch to numeric mode and the tool compares actual values, ordering one, two, three, ten correctly. This is the single most common sorting mistake.
Can I remove duplicate lines while sorting?
Yes. Enable the deduplicate option and the tool removes repeated lines as part of the sort, producing a clean, ordered, unique list in one step. This is especially useful when merging several lists together, since sorting groups identical lines adjacently and the deduplicate pass then strips the repeats, leaving one of each in order.
Does the sorter treat uppercase and lowercase differently?
By default, standard sorting places uppercase letters before lowercase because of their character codes, so Zebra can appear before apple. Turn on the case insensitive option to treat both the same, which gives the dictionary style order most people expect for names and words. Choose case sensitive only when the distinction genuinely matters for your data.
Is there a limit on how many lines I can sort?
There is no fixed limit for typical use, and the tool comfortably handles lists from a few lines to many thousands directly in your browser. Extremely large files are better suited to a command line sort, but for the everyday lists people paste, names, keywords, tags, filenames, the online sorter processes them instantly at no cost.
What is natural sort order?
Natural sort order compares the numeric parts of mixed text as values rather than characters, so file2 comes before file10, matching human expectations. Pure lexicographic sorting would place file10 before file2 because the character one precedes two. Natural sorting is what operating systems use for file listings and is helpful whenever your lines mix words with numbers, such as versioned names.
Is the text line sorter free to use?
Yes, it is completely free with no account and no usage limit. You can sort as many lists as you like, as often as you like, with full access to the alphabetical, numeric, case and deduplicate options. It runs entirely in your browser on any device, so there is nothing to download, install or pay for.
How do I fix a line that sorts to an unexpected place?
The usual cause is hidden whitespace, a leading or trailing space or tab that changes how the line compares. Clean the list with a whitespace remover first, then sort again. Also check whether the line contains a different character than it appears to, such as a look alike symbol, which can also affect its sorted position.