Qgenx Tools

Sort Lines

Sort lines alphabetically, numerically, by character length, reverse, or shuffle locally in your browser with zero uploads.

Runs in your browser
0
Total lines
0
Non-empty
0
Chars
Unsorted
Last sort

About this tool

Lines split cleanly on LF/CRLF boundaries, optionally filter blank lines, and sort in memory using localeCompare, numeric parseFloat extraction, character length comparison, or Fisher–Yates unbiased shuffling.

How to use the line sorter

  1. Paste your list into the box, with one item on each line.
  2. Choose a sort order: A–Z, Z–A, Numeric, By length or Reverse.
  3. Choose Shuffle to put the lines in a random order, if you need a random draw.
  4. Copy the sorted list, or download it as a .txt file.

How each sort works

A–Z and Z–A compare the lines alphabetically and ignore upper and lower case, so Apricot sits next to apple. Numeric reads the number at the start of each line, so 2 comes before 10, which a plain alphabetical sort would not do. By length orders lines from shortest to longest, which helps when you need a neat column of names or codes.

Reverse flips the current order without changing the lines, and Shuffle gives a new random order each time you press it. Use Shuffle to pick a random winner, or to test that your code does not depend on order.

A worked example

The sample list mixes fruit names with lines that start with numbers. A–Z puts the fruit in alphabetical order and mixes in the numbered lines by their first character. Numeric moves the numbered lines into order by value, so 2 apples comes before 10 bananas. The difference between the two sorts shows why choosing the right one matters.

  • Sort a list of file names so that file2 comes before file10 by using Numeric.
  • Put a list of names into A–Z order before you print an attendance sheet.

Who uses a line sorter

  • Teachers and event organisers ordering names on lists and registers.
  • Developers sorting imports, dependency lists and configuration keys.
  • Writers ordering glossary entries, index terms or bibliography lines.
  • Analysts putting a list of IDs into order before comparing it with another list.
  • Anyone who needs a neat list in a few seconds.

Tips and common mistakes

  • A–Z ignores upper and lower case. Use Numeric or check spacing when the list contains codes.
  • Numeric only uses the leading number on each line. Lines without a number are placed in a sensible order.
  • Duplicate lines are kept. Use the Remove Duplicate Lines tool first if you want each item once.
  • Shuffle is random, so the result changes each time. Copy the list before you shuffle if you want to keep the order.
  • All sorting happens in your browser, so a private list never leaves your device.

Frequently asked questions

Alphabetical sort compares characters left to right, putting “10” before “2”. Numeric sort extracts the numeric value so 2 comes before 10.

Related browser tools