Text Line Sorter
Sort lines alphabetically, by length, numerically, or shuffle them randomly. Remove duplicates and trim whitespace in one click.
How to Use
Paste Your List
Type or paste text in the input box, one item per line. Any kind of list works — words, names, URLs, or numbers.
Choose Sort Mode
Click A→Z, Z→A, Shortest, Longest, Shuffle, Reverse, or a numeric mode to set how your lines will be ordered.
Set Options
Toggle case-insensitive sorting, deduplication, whitespace trimming, or symbol-ignoring as needed, then click Sort Lines.
Copy or Download
Use the toolbar to copy the sorted result to your clipboard, save it as a .txt file, or swap it back to the input for further sorting.
Sort Lines of Text — Alphabetical, Numerical, and Random Order
Sorting a list by hand works for ten items. For a hundred or a thousand, you need a tool. Paste your list here and sort it any way you need — alphabetically, in reverse, by number, or in random order — in one click. No spreadsheet needed.
Sort modes
A → Z (alphabetical): Sorts lines from A to Z. Uppercase letters come before lowercase in standard ASCII order — if you want case-insensitive alphabetical sorting, enable the "ignore case" option so "banana" and "Banana" sort to the same position.
Z → A (reverse alphabetical): Sorts from Z to A. Useful when you want the latest entries in a date-sorted list (if dates are in ISO format like 2025-01-15, alphabetical order equals chronological order, and reverse alphabetical gives you newest-first).
1 → 9 (numerical ascending): Sorts lines that start with numbers in numerical order — so "10" comes after "9" rather than before "2" (which is what alphabetical sort would do). Lines that don't start with a number fall back to alphabetical ordering.
9 → 1 (numerical descending): Reverse numerical sort. Highest value first.
Random (shuffle): Randomises the order of all lines. Each click gives a different result. Useful for creating randomised question sets, shuffling a playlist order, or picking a random order for a team rotation.
Common use cases
Organising keyword lists: After gathering hundreds of keywords for SEO research, sorting alphabetically makes it much easier to group related terms and spot gaps or duplicates. Run it through this tool, then through the duplicate remover, and you have a clean sorted keyword list.
Alphabetising a bibliography or reference list: Most citation formats (APA, MLA, Chicago) require references sorted alphabetically by author surname. If your reference management tool isn't doing this automatically, paste your list here and sort.
Organising product catalogues: A product list sorted A-Z is easier to scan, easier to search manually, and looks more professional in a printed catalogue or on a shelf inventory sheet.
Sorting data exports: CSV exports from databases or apps sometimes come in insertion order or a random-seeming order. Sort the relevant column here to make the data easier to work with before importing it somewhere else.
Randomising quiz questions or assignments: Teachers preparing question papers, team leads assigning work, or anyone who needs to shuffle a list fairly can use the random sort to get an unbiased random order.
Ranking or prioritising task lists: If you have a list of tasks with numeric priority scores at the start of each line ("1 - Write report", "3 - Review code", "2 - Update docs"), numerical sort instantly puts them in priority order.
Sorting names: For an event roster, a seating chart, or a classroom attendance list — sort by last name alphabetically so it's easy to find anyone quickly.
How to use it
Paste your list into the input box, one item per line. Select the sort mode you want. The sorted result appears in the output box. Copy it from there. If you want to deduplicate at the same time, enable the "Remove duplicates" option before sorting — this combines the sort and dedup operations in one step.
The "Swap" button replaces your input with the sorted output so you can chain operations — for example, sort alphabetically first, then sort again by line length if you need that.
Tips
Sorting is case-sensitive by default. "Zebra" would sort before "apple" in default mode because uppercase Z has a lower ASCII value than lowercase a. If you're sorting natural language words and want mixed-case items to sort together correctly, enable case-insensitive mode.
For sorting dates, ISO 8601 format (YYYY-MM-DD) sorts correctly with alphabetical sorting because the year comes first. If your dates are in DD/MM/YYYY (common in India), alphabetical sort will sort by day first, which is incorrect. Reformat to ISO before sorting if you need date order.
There's no stable sort indicator — if two lines are equal under the sort criteria, their relative order in the output may vary. For most practical use cases this doesn't matter.
Limitations
This tool sorts by line. It doesn't sort columns within a line or sort based on a specific field within a delimited row. For column-based sorting of CSV or tabular data, a spreadsheet is the right tool.
The random sort uses JavaScript's Math.random(), which is a pseudorandom number generator — sufficient for shuffling a question list or rotating a team rota, but not cryptographically secure for any security-sensitive use case.
Very large lists (50,000+ lines) may take a noticeable moment to sort depending on your device, but this is usually not a problem for typical use.
Frequently Asked Questions
Yes. Use the "1→9" or "9→1" modes for numerical sorting. Lines that are not numbers fall back to alphabetical order.
It strips any non-alphanumeric characters from the start of each line before comparing, so items like "- Apple" and "Apple" sort together correctly.
Yes. Enable the "Remove duplicates" checkbox and duplicates will be removed from the sorted output (case-insensitive if that option is also on).
Yes. Swap replaces the input with the sorted output so you can chain sorts. Your original is not saved, so copy it first if needed.
There is no hard limit, but very large lists (10,000+ lines) may take a moment to process depending on your device.