Sort Lines Alphabetically
Paste any list of text and sort it A to Z, Z to A, by shortest or longest line, or shuffle it randomly. Works instantly in your browser β no data ever leaves your device.
How to Sort Lines of Text
Three steps, under ten seconds.
Paste your lines
Type or paste any list of text into the input box above β one item per line. Works with names, URLs, keywords, code imports, or any list.
Choose a sort order
Click A β Z to alphabetize, Z β A for descending, Shortest or Longest First to sort by length, or Shuffle for a random order.
Copy the sorted text
Hit Copy to send the sorted lines to your clipboard. The line count is shown in the footer so you always know what you have.
About This Line Sorter
Sorting a list by hand is slow and error-prone β especially when you are dealing with dozens or hundreds of items. This tool handles alphabetical sorting, length-based sorting, and random shuffling in a single click, with no installation or sign-up required.
A β Z uses JavaScript's localeCompare method for language-aware alphabetical ordering β accented characters and mixed-case lines are handled correctly. Z β A simply reverses that order. Shortest First and Longest First rank lines by their character count, which is useful for spotting outlier entries in a dataset or finding the longest URL in a list.
Shuffle randomizes line order using the Fisher-Yates algorithm β the gold standard for unbiased random permutation. Every possible ordering of your lines is equally likely, making it suitable for creating randomized quiz questions, survey answer orders, or playlist shuffles.
The Remove empty lines toggle strips any blank rows before sorting, keeping your output clean. All processing runs entirely in your browser β nothing is uploaded, stored, or logged.
Frequently Asked Questions
What does alphabetizing text mean?
Alphabetizing text means sorting a list of lines into A-to-Z order based on the first character of each line, then subsequent characters for tiebreaking β the same ordering used in dictionaries and indexes. This tool uses JavaScript's locale-aware comparison so punctuation and mixed-case lines are handled correctly.
Does it preserve blank lines?
By default, blank lines are included in the sort and appear at the top because an empty string comes before any non-empty string alphabetically. To strip blank lines before sorting, toggle the "Remove empty lines" option. This removes any line that is empty or contains only whitespace before the sort is applied.
Can I sort a numbered list?
Yes β the entire line including its number prefix is treated as the sort key. So "1. Apples" and "2. Bananas" sort by their full line text. If you want to sort alphabetically by the item name only, strip the numeric prefixes first, sort, then renumber. The tool sorts each full line exactly as written.
Does case matter when sorting?
The sort uses localeCompare, which is case-insensitive by default β so "Apple", "apple", and "APPLE" are treated as equivalent. Lines starting with the same word in different cases will appear adjacent in the output. If you need strict case-sensitive sorting, convert your text to a uniform case first using the Convert Case tool, then sort.
Is there a line limit?
There is no hard limit. The tool runs entirely in your browser, so the practical ceiling is your device's memory. Lists of tens of thousands of lines sort in well under a second on any modern device. Very large inputs may cause a brief pause, but no artificial cap is imposed.
More Free Text Tools
Everything else you need to clean and transform text, right here.
Convert Case
Transform text to UPPERCASE, lowercase, Title Case, camelCase, snake_case and more.
Remove Duplicates
Strip repeated lines from any list or block of text instantly.
Find & Replace
Find any word or phrase in your text and replace it in bulk.
Remove Blank Lines
Strip all empty lines from a block of text in one click.
Reverse Text
Flip text backwards, reverse word order, or reverse line order.
Word Frequency
Count how often each word appears in any block of text.