How to use the Sort Lines
- Type or paste your text into the box.
- Choose a sort order and whether to ignore case.
- Copy the result or download it as a text file.
What does this tool do?
Plain alphabetical sorting puts “item 10” before “item 2”. Natural sorting understands the numbers, so lists of files and versions come out in the order a person expects.
Shuffle uses your browser's secure random generator, so every order is equally likely.
What each sort order does (with real output)
Given the lines item 10, Item 2, élan, zebra, apple, Price 1,200, Price 950 and no number: A → Z gives apple, élan, item 10, Item 2, no number, Price 1,200, Price 950, zebra. Natural sorting understands the numbers, so Item 2 comes before item 10. By number sorts on the first number in each line (commas in 1,200 are ignored), giving Item 2, item 10, Price 950, Price 1,200, and then lines without a number at the end in alphabetical order.
Shortest first and Longest first sort by length and break ties alphabetically. Reverse current order simply flips the list, and Random shuffle uses your browser's secure random generator, so every order is equally likely.
Case, accents and empty lines
Sorting follows the language rules of your browser, so accented letters sort with their base letter (élan sits next to elephant, not after zebra). With “Ignore upper/lower case” on, Apple and apple are treated as equal; turn it off and lower-case comes first within the same letter. “Remove empty lines” drops blank lines before sorting.
Related: Remove Duplicate Lines · Reverse a List
Why use it?
- Alphabetize names, glossaries and bibliographies.
- Order files and versions naturally.
- Randomize lists fairly.
Use cases
- Alphabetising names, glossary terms and bibliographies.
- Ordering file names and version numbers the way people read them.
- Ranking a list of prices or scores.
- Shuffling a quiz or a playing order.
Natural vs alphabetical
Alphabetical: file1, file10, file2. Natural: file1, file2, file10.
Common mistakes
- Using A → Z on numbered items: alphabetical order puts 10 before 2. Use Natural.
- Sorting a CSV line by line: it sorts whole rows by their first characters, header included. Use a spreadsheet for column sorting.
Privacy
Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us. There's no account to create and nothing to install.
Frequently asked questions
Why does “item 10” come before “item 2” in other tools?
Plain alphabetical sorting compares text character by character, and “1” comes before “2”. Natural sorting reads the numbers as numbers, so “item 2” comes before “item 10” as you'd expect.
Is the shuffle truly random?
It uses your browser's secure random number generator with an unbiased shuffle, so every possible order is equally likely.
Content last updated . See how M2Toolkit works.