Skip to content

Sort Lines

Sort lines of text alphabetically (A-Z or Z-A), by line length, numerically, or shuffle and reverse them randomly.

Loading...
1. Paste or type the lines of text you want to sort into the input area. 2. Select a sorting method from the options: A-Z, Z-A, shortest to longest, longest to shortest, numerical, shuffle, or reverse. 3. Toggle the case-sensitive option if you want uppercase and lowercase letters treated differently during alphabetical sorting. 4. Review the sorted output that appears instantly in the result area. 5. Click the copy button to copy the sorted lines to your clipboard.

About This Tool

The Sort Lines tool organizes your text by sorting each line according to your chosen method. Whether you need alphabetical ordering for a list of names, numerical sorting for data, length-based sorting for analysis, or a randomized shuffle, this tool handles it all with a single click.

Available sorting methods include A-Z (ascending alphabetical), Z-A (descending alphabetical), shortest to longest (by character count), longest to shortest, numerical sort (for lines starting with numbers), random shuffle, and full reverse. Case-sensitive and case-insensitive options are available for alphabetical sorting, giving you fine-grained control.

This tool is particularly useful for organizing lists, preparing data for import into spreadsheets, cleaning up configuration files, randomizing quiz questions, and more. Paste your text, pick a sort method, and get organized output instantly. Everything runs client-side in your browser.

Frequently Asked Questions

Lines starting with numbers are sorted before letters in standard alphabetical order. Special characters are sorted based on their Unicode code points, which generally places them before numbers and letters.
The numerical sort mode specifically looks for numbers at the beginning of each line and sorts by those values. For purely alphabetical sorting of lines that happen to contain numbers, use the A-Z mode.
The shuffle uses a Fisher-Yates algorithm with JavaScript pseudo-random number generation. Each shuffle produces a different random order. While not cryptographically random, it is more than sufficient for general randomization needs.
The sort tool focuses on ordering lines. To remove duplicates, use the Remove Duplicate Lines tool first, then sort the result. Both tools are linked for easy workflow.
Z-A sorting arranges lines in descending alphabetical order. Reverse simply flips the entire list upside down without any alphabetical consideration - the last line becomes the first, and so on.

Related Tools

Remove Duplicate Lines

Remove duplicate lines from your text while preserving the original order. Supports case-sensitive and case-insensitive modes.

Text and Writing

Word Counter and Character Counter

Count words, characters, sentences, and paragraphs in your text. Includes reading time and speaking time estimates.

Text and Writing

Find and Replace

Find and replace text with support for regular expressions, case-sensitive matching, and whole-word search options.

Text and Writing

Whitespace Remover and Trimmer

Remove extra whitespace, trim leading and trailing spaces, collapse multiple spaces, and clean up messy text formatting.

Text and Writing

Case Converter

Convert text between UPPER, lower, Title, Sentence, camelCase, snake_case, kebab-case, CONSTANT_CASE, and PascalCase.

Text and Writing

List Converter

Transform lists between formats - comma-separated, newline, bulleted, numbered, JSON array, SQL IN clause, and HTML.

Text and Writing