Skip to content
PocketDesk
Your files are processed on your device, never uploaded

Sort lines

Put a list in order, or shuffle it. Your list stays on your device.

  • Runs in your browser
  • No sign-up
Result

How to sort lines

  1. Paste your list into the box, one item per line.
  2. Pick Sort by. Choose Alphabetical, Number, Line length, Reverse current order or Random shuffle.
  3. Turn on Descending to flip the order, or Case sensitive if capital letters should matter.
  4. Copy the sorted list or download it.

Sort modes

Alphabetical compares lines using your browser’s language rules, with natural number handling. That puts “file2” before “file10”, which a plain character sort would not. By default capital letters are ignored, so “banana” and “Banana” sit together.

Number takes the first number on each line, such as the price in “Tea 3.50”, and sorts by value. Line length orders by the count of visible characters, so an emoji counts as one.

Reverse current order flips the list without sorting. Random shuffle mixes the lines using a secure random source, which is handy for picking an order for a draw or a quiz.

Empty lines are kept. In an alphabetical sort they gather at the top.

Tips

  • Remove repeats first with remove duplicate lines, then sort.
  • Sorting names? Check that every line starts the same way, such as surname first, before sorting.
  • For a fast turnaround of a list written in a single row, change the separators to line breaks with find and replace.
  • To flip the characters inside each line instead, use reverse text.

Good to know

Sorting never edits a line. It only changes the order, so every line you put in comes out again. Equal lines keep their original order, which is called a stable sort. That matters when you sort by length or by number and many lines tie. Sort a list twice, first by one rule and then by another, to get a two-level order.

Privacy

Sorting happens on your device. Your list is not uploaded, saved on a server, or added to the page address.

Questions

How does alphabetical sorting treat numbers?

Numbers inside the text sort by value, so item 2 comes before item 10. This is called natural sorting.

How does Number sorting work?

It reads the first number found on each line and sorts by it, including decimals and negative numbers. Lines with no number go to the end.

Is the random shuffle really random?

It uses your browser's secure random generator and the Fisher-Yates method, so every order is equally likely.

Does it sort Hindi or accented text?

Yes. Sorting follows your browser's language rules, so accented letters and other scripts are placed in a sensible order.

Is my list uploaded?

No. Sorting runs in your browser, and your list never leaves your device.

More text tools