EN FR ES
Clean

Line Sorter

Sort any list of lines alphabetically (A–Z or Z–A), by length, or randomly in seconds. Free, browser-based, no data sent to servers.

Client-Side Verification: This utility operates exclusively via client-side JavaScript. Zero data packets are sent to external servers. Open your browser's Developer Tools → Network tab to verify zero active POST requests during processing.
Sorted Result
Your sorted list will appear here.

Five Sort Modes

A → Z: Ascending alphabetical order
Z → A: Descending alphabetical order
Shortest First: Lines ordered from fewest to most characters
Longest First: Lines ordered from most to fewest characters
Shuffle: Random order using Fisher-Yates algorithm

Common Use Cases

  • Sorting glossary terms, bibliographies, or reference lists alphabetically.
  • Organizing config file keys for easier navigation.
  • Preparing quiz questions or flashcard sets in random order.
  • Sorting email addresses, domain names, or URL lists for deduplication.

How to Use the Line Sorter

Paste your list with one item per line and click one of the five buttons: A → Z, Z → A, Shortest First, Longest First or Shuffle. The reordered list appears below and can be copied with one click. You can click a different button to re-sort the same input.

A Worked Example

Take this list of seven lines: banana, Apple, cherry, apple, 10, 9, 2.

A → Z: 10, 2, 9, Apple, apple, banana, cherry
Shortest First: 9, 2, 10, Apple, apple, banana, cherry

Two things are worth noticing. First, the sort ignores capitalization, so "Apple" and "apple" sit side by side and keep the order they had in your input. Second, the numbers are sorted as text, character by character, so "10" comes before "2" and "9".

How Each Mode Behaves

  • A → Z and Z → A use your browser's language-aware comparison, so accented letters are placed sensibly. Blank lines sort to the top in A → Z order, so remove them first if you do not want them.
  • Shortest First and Longest First compare the number of characters on each line, including spaces. Lines of equal length stay in their original relative order.
  • Shuffle produces a different random order each time you click it.

Sorting Numbers Correctly

The sort has no numeric mode, so a list of numbers will come out as 1, 10, 2. To get 1, 2, 10, pad the numbers with leading zeros to the same length first (01, 02, 10). The same approach works for dates written as year-month-day, which sort correctly as text.

Common Uses

  • Alphabetizing a bibliography, glossary, guest list or set of keywords.
  • Ordering CSS classes, imports or configuration entries so that changes are easy to compare.
  • Shuffling quiz questions, flashcards or a list of names for a random draw.
  • Sorting first, then using the Duplicate Highlighter, makes repeated entries easy to spot by eye.

Frequently Asked Questions

How do I sort a list alphabetically online?
Paste your list into the Line Sorter with one item per line, then click "A → Z." The tool instantly reorders every line from A to Z and displays the sorted result, ready to copy.
Can I sort lines by length?
Yes. The Line Sorter includes a sort-by-length option that arranges lines from shortest to longest (or longest to shortest). This is useful for formatting tables, aligning visual layouts, or understanding the range of your data.
Does the sort work on numbers?
The default alphabetical sort treats lines as strings, so numbers sort lexicographically (1, 10, 2). For correct numeric sort, ensure your numbers are zero-padded to the same digit length before sorting (e.g., 01, 02, 10).
Can I randomize the order of my lines?
Yes. The "Shuffle" option randomizes the order of all lines using a Fisher-Yates algorithm. This is useful for creating randomized lists, quiz questions, or shuffling flashcard data.
Is the alphabetical sort case-sensitive?
No. "Apple" and "apple" are treated as equal for sorting, so they appear next to each other in the order they had in your input.
Where do blank lines go when I sort?
In A → Z order, blank lines sort to the top, and in Z → A they move to the bottom. Remove empty lines first if you do not want them in the result.

Discover all five sort modes and real-world applications for organized lists.

Read the full guide →
Copied!