1. Home
  2. Text
  3. Sort Lines

Sort Lines

Sort lines alphabetically, naturally or by length — or shuffle them.

Runs in your browser · No upload Works offline
Numbers are compared by value, so "Chapter 2" comes before "Chapter 10".
Sorted lines
Appendix chapter 1 Chapter 2 Chapter 2 Chapter 3 Chapter 10 Index
Lines
7
Empty lines removed
1
Duplicates removed
0

How to use

  1. Paste a list with one item per line — names, file names, keywords, URLs.
  2. Choose how to sort and whether ascending or descending; the result updates as you go.
  3. Optionally remove empty or duplicate lines, then Copy or Download .txt.

Sort modes compared

Mode Compares by Example (ascending)
Natural Numbers inside the text by value file1, file2, file10
Alphabetical Dictionary order, digit by digit file1, file10, file2
Length Number of characters (an emoji counts as one) fig, pear, banana
Reverse No sorting — flips the current order c, a, b → b, a, c
Shuffle Random order Different on every shuffle

Use natural order for anything numbered: chapters, invoice numbers, versions, image files. Plain alphabetical order puts file10 before file2 because it compares the character 1 with 2.

Details of the comparison

  • Sorting is locale-aware (Unicode collation), so accented letters sort next to their base letter: cafe, café, cafes.
  • With Ignore case on, apple and Apple are treated as equal and keep their original order. With it off, uppercase comes first when the letters are otherwise the same.
  • Sorting is stable: equal lines keep their relative order, in descending order too.
  • Lines starting with a space or punctuation sort before letters.

Shuffle

Shuffling uses the Fisher–Yates algorithm with your browser’s cryptographic random number generator (crypto.getRandomValues), so every ordering is equally likely. It is suitable for picking a raffle order, presentation order or random groups. Press Shuffle again for a new order.

FAQ

Can I sort a column from Excel or Google Sheets?

Yes. Copy the column, paste it here, sort, and paste the result back. Each cell becomes one line.

How do I remove duplicates without changing the order?

Use remove duplicate lines, which keeps the original order.

Can I compare the list before and after?

Paste both into text diff to see which lines moved or changed.

Coming soon

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.