Sort Lines
Sort lines of text in alphabetical order (A-Z or Z-A), natural number sequence, character length, or random order.
Your text 56 chars · 8 lines
Result
How to use Sort Lines
- Paste lines into the editor.
- Select a sorting mode: A-Z, Z-A, Natural Numbers, Line Length, or Shuffle.
- Copy the sorted output.
About Sort Lines
Sort any list of lines alphabetically, in reverse, by number, by length, or into a random order. Paste a list and pick an order; the sorted result appears beside your original, ready to copy or download.
Related tools: Word Counter, Byte Counter & Character Counter, Case Converter — Title Case & More, Remove Extra Spaces
Choosing the right order
A to Z and Z to A sort alphabetically using your browser's language rules, so accented letters sort next to their plain versions. Natural order is for lists that contain numbers: it puts Item 2 before Item 10, where a plain alphabetical sort would put Item 10 first.
Shortest first and longest first sort by the number of characters in each line, with alphabetical order breaking ties. Random shuffle mixes the list; press Shuffle again for a new random order without changing your input.
Capitalization and blank lines
By default, sorting ignores capitalization so apple and Apple sit together. Turn on Case-sensitive if uppercase and lowercase entries should be grouped separately.
Every line is sorted, including blank lines, which collect at the top of an A to Z sort. To remove them first, clean the list with Remove Extra Spaces or Remove Duplicate Lines.
Common uses
- Alphabetizing names
- Sort a list of names, tags, or bibliography entries from A to Z.
- Numbered files and versions
- Use natural order so chapter 2 comes before chapter 10.
- Random picks
- Shuffle a list of names for a raffle, team assignment, or presentation order.
- Code and config
- Sort import lines, CSS properties, or environment variables to make them easier to scan.
Questions about Sort Lines
- What is natural number sort?
- Natural sort orders strings with numbers by numeric value (e.g. 'Item 2' before 'Item 10').
- Why does Item 10 come before Item 2?
- That is plain alphabetical order, which compares character by character. Choose Natural order to sort the numbers by value.
- Is the shuffle really random?
- It uses the standard Fisher-Yates shuffle, so every order is equally likely. It is fine for raffles and team picks, not for security purposes.
- Can I sort a comma-separated list?
- The tool sorts lines. Split the list first with Find and Replace: turn on Regular expression, find ,\s* and replace with \n.
- Does sorting keep blank lines?
- Yes. Blank lines are sorted like any other line and gather at the top in A to Z order. Remove them first with Remove Extra Spaces if you do not want them.
More tools like Sort Lines
- Word CounterCount words, characters, sentences, paragraphs, and reading time.
- Byte & Character CounterCount UTF-8 bytes, characters, letters, digits, and whitespace.
- Case ConverterConvert text to uppercase, lowercase, title case, camelCase, snake_case, and kebab-case.
- Remove Extra SpacesStrip duplicate spaces, tabs, empty lines, and trailing whitespace.
Comments
Questions, ideas, or a bug in Sort Lines? Let us know.