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:
A sort text lines tool puts a pasted list in order — alphabetically A to Z or Z to A, or numerically smallest to largest — free, with no account. Paste one item per line, choose the order, and copy the sorted result. It runs entirely in your browser, so nothing is uploaded or stored.
On this page
- How to Sort Text Lines Step by Step
- How Text Sorting Works and Why Order Rules Matter
- Online Sorter Versus Spreadsheet or Command Line
- 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
- Frequently Asked Questions
How to Sort Text Lines Step by Step
- Paste your lines, one item per line, into the input box. Names, filenames, numbers, tasks — anything where each line is a separate entry.
- Choose the Order: A → Z, Z → A, Numeric ascending, or Numeric descending. A → Z is the default.
- Leave Case-insensitive on (it is on by default) for names and words, so Apple and apple sit together. Untick it only when capitalisation genuinely matters for your data.
- Tick Remove duplicates if you want repeated lines stripped out as part of the sort.
- Click Sort. The ordered lines appear in the Result box with a line count ("N line(s) sorted.").
- Click Copy to take the sorted lines back into your document, spreadsheet or code. There is no download button — Copy is the only export.

How Text Sorting Works and Why Order Rules Matter
Sorting text seems trivial until you meet the rules that govern it. This tool compares lines using locale-aware ordering, not raw character codes — so with the default case-insensitive setting, the list banana, Apple, cherry, apple, Zebra sorts A to Z as Apple, apple, banana, cherry, Zebra. And even with case sensitivity switched off, apple still comes before Zebra: the old idea that "all capitals sort before all lowercase" does not apply here.
The gap between alphabetical and numeric sorting causes the most confusion. Sorted as text, the numbers 1, 10, 2, 3 order as 1, 10, 2, 3, because the character 1 comes before the character 2 and the comparison looks at the first character first. Sorted numerically, they correctly order 1, 2, 3, 10. 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.
Numeric mode reads the number at the start of each line: 10 apples counts as 10, 2.5 as 2.5, and −5 as −5. A line with no leading number counts as 0, so in a numeric sort banana lands near the top, after the negatives and before the positives. Worked example, Numeric ascending on 10 apples, 2 pears, banana, −5, 2.5 gives −5, banana, 2 pears, 2.5, 10 apples.
There is no natural sort. Pure character-by-character sorting places file10 before file2, because the character 1 precedes the character 2 — verified on this tool: file10, file2, file1 sorts A to Z as file1, file10, file2. If your list mixes words and numbers, such as versioned filenames, rename the items or split the numbers out first; this tool cannot sort the embedded numbers as values.
Deduplication runs before the sort, on the exact lines as typed, so Apple and apple are different lines even when case-insensitive sorting is on. With Remove duplicates ticked, Apple, banana, apple, Apple, banana becomes Apple, apple, banana. Empty lines are kept as lines and sort to the top, and a trailing newline adds a phantom empty line — remove blank lines first for a clean result. A leading space also changes the order: " apple" (with a space) sorts before Apple.
| Input | Mode | Result |
|---|---|---|
| banana, Apple, cherry, apple, Zebra | A → Z, case-insensitive (default) | Apple, apple, banana, cherry, Zebra |
| banana, Apple, cherry, apple, Zebra | A → Z, case-sensitive | apple, Apple, banana, cherry, Zebra |
| 1, 10, 2, 3 | A → Z (text) | 1, 10, 2, 3 |
| 1, 10, 2, 3 | Numeric ascending | 1, 2, 3, 10 |
| 1, 10, 2, 3 | Numeric descending | 10, 3, 2, 1 |
| file10, file2, file1 | A → Z | file1, file10, file2 (no natural sort) |
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 pasted list at a time, no natural sort | 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, natural-sort options | Requires terminal knowledge, syntax for numeric and case options | Developers processing large files in a pipeline |
For a tiny list of three or four lines you can eyeball the order, but beyond a handful of lines manual reordering is error prone and painfully slow. The online tool is the fast middle ground: paste, pick the order, copy.
Who Needs to Sort Lines of Text
Writers and editors. An editor sorts a glossary, index or reference list alphabetically so it is easy to scan and check for gaps, without manually reshuffling entries.
Developers and data workers. A developer sorts a list of keys, tags or filenames, often with deduplication, to produce a clean canonical set for code or configuration.
Marketers managing keywords. A marketer alphabetises or numerically orders a keyword or URL list to spot patterns, group related terms, and remove accidental repeats before analysis.
Teachers and administrators. An administrator sorts a class roster or attendee list into alphabetical order for a register or seating plan, straight from a pasted list.
Anyone tidying a list. A person with a jumbled list of items, tasks or names sorts it into a sensible order in seconds rather than dragging lines around by hand.

Pro Tips for Clean, Correct Sorting
Switch to numeric mode for numbers. If your list is numbers and the order looks wrong, you are almost certainly sorting as text. Change to numeric mode so values order by size rather than by leading character.
Leave case-insensitive on for names. For human-readable lists such as names and words, it puts Apple and apple together, matching the dictionary order people expect. It is on by default — check it is still on before you sort.
Deduplicate while you sort. When merging lists, tick Remove duplicates to get a clean, unique, ordered result in one step rather than sorting and then hunting for repeats. Remember it is exact-match: Apple and apple both survive.
Trim whitespace first if results look off. Leading or trailing spaces affect sort order and can push a line to an unexpected place. If sorting seems wrong, run the list through our Whitespace Remover first.
Remove blank lines to avoid gaps. Empty lines sort to the top and clutter the result. Clean them out beforehand for a gap-free output.
Reverse sort to find extremes fast. A descending sort brings the largest numbers or last alphabetical entries to the top — a quick way to find maximum values or check the end of a range without scrolling.
Common Text Sorting Mistakes to Avoid
Sorting numbers as text. Leaving the tool in alphabetical mode for a list of numbers produces the order 1, 10, 2, 3, which looks broken. It is correct for text but not for values. Switch to numeric mode whenever your lines are numbers.
Expecting natural sort. There is no natural-sort option: file10 sorts before file2. Do not assume versioned filenames will come out in version order.
Expecting Apple and apple to deduplicate. Remove duplicates is exact-match and case-sensitive even when case-insensitive sorting is on, so both capitalisations survive.
Ignoring case sensitivity. Untick Case-insensitive only when the capitalisation distinction genuinely matters for your data; for human lists, leave it on so names that should sit together do.
Overlooking hidden whitespace. Trailing spaces and tabs change how a line compares and can push it to a surprising position. If a line sorts to the wrong place, invisible whitespace is the usual culprit, so clean the input first.
Leaving blank lines in the list. Empty lines get sorted like any other line and end up bunched at the top, creating gaps in your result. Remove blank lines before sorting for a clean, gap-free output.
Assuming the result appears as you type. It does not. You must click Sort — typing alone sorts nothing.
Expecting a download button. Copy is the only export. There is no file to save; copy the result and paste it where it belongs.
Related Tools You May Need Next
Remove Duplicate Lines. Tidy the input by removing repeated lines before sorting.
Whitespace Remover. Clean extra spaces and blank lines from a list before sorting.
Line Counter. Confirm how many entries the sorted list has.
Reverse List. Flip 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 A → Z in the Order dropdown, and click Sort. For human-readable lists, leave the case-insensitive option on (it is on by default) so capitalised and lowercase words sort together as they would in a dictionary. Then copy the sorted output.
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 1 precedes the character 2. Switch to Numeric ascending and the tool compares actual values, ordering 1, 2, 3, 10 correctly. This is the single most common sorting mistake.
Does the sorter do natural sort — file2 before file10?
No. There is no natural-sort option. The tool compares characters, so file10 sorts before file2: file10, file2, file1 comes out as file1, file10, file2. If you need version order, rename the items (file02, file10) or split the numbers out before sorting.
Can I remove duplicate lines while sorting?
Yes. Tick Remove duplicates and the tool strips repeated lines as part of the sort, producing a clean, ordered, unique list in one step. Note that deduplication is exact-match and case-sensitive: Apple and apple count as different lines and both survive, even with case-insensitive sorting on.
Does the sorter treat uppercase and lowercase differently?
By default, no: the Case-insensitive checkbox is on, so Apple and apple sit together in dictionary order. If you untick it, the tool still uses locale-aware ordering, not raw character codes — verified: apple sorts before Apple, and apple before Zebra. Choose case-sensitive only when the distinction genuinely matters for your data.
Is there a limit on how many lines I can sort?
No line limit is stated in the tool. It runs entirely in your browser, and a 5,000-line run of the same sorting code completed in 4 milliseconds in our check, so everyday lists — names, keywords, tags, filenames — sort instantly. Extremely large files are still better suited to a command line sort.
Why did a line sort to an unexpected place?
The usual cause is hidden whitespace: a leading or trailing space or tab changes how the line compares. Clean the list with the Whitespace Remover first. The other common cause is sorting numbers as text — switch to a numeric mode.
What happens to blank lines?
Blank lines are kept and sort to the top of an A to Z result, and a trailing newline adds a phantom empty line at the end of your paste. Remove blank lines before sorting for a clean, gap-free output.
What happens to lines that are not numbers in numeric mode?
A line with no leading number counts as 0. So in Numeric ascending, banana lands near the top — after negative numbers and before positive ones — and 10 apples counts as 10 because its number comes first. A line such as "apples: 10" counts as 0, because its number is not at the start.
Is the text line sorter free to use?
Yes, it is completely free with no account. It runs entirely in your browser on any device, so there is nothing to download, install or pay for, and your list is never uploaded.