Skip to content
Toolew.com

Sort Lines

Sort lines alphabetically, in natural or numeric order, by length or word count, ascending or descending.

Runs in your browser. Your data is not uploaded.
Loading tool…

This guide is not yet available in your language and is shown in English.

Tool guide

What this tool does

Sort Lines orders any list using real language rules rather than raw character codes. Natural order puts file2 before file10, numeric mode sorts by the first number in each line, and you can sort by length or word count, reverse a list, remove duplicates and choose the alphabet rules for languages such as German, Swedish or Turkish.

A plain computer sort compares character codes, so “Zebra” comes before “apple”, “Éclair” lands after “zucchini” and “file10” sorts ahead of “file2”. That is rarely what a person expects when alphabetising names, glossary terms or file lists.

This tool uses the Unicode Collation Algorithm through the browser’s Intl.Collator, the same engine that sorts contacts on your phone. Accented letters sort beside their base letters, case is ignored unless you ask otherwise, and the natural order option compares digit runs as numbers. You can also choose the language rules, because alphabets differ: Swedish places Ä and Ö after Z, while German sorts them with A and O.

How to use Sort Lines

  1. Paste your list into Lines, one item per line.
  2. Choose Sort by: Natural order, Alphabetical, First number in each line, Line length, Word count or Reverse current order.
  3. Turn on Descending for Z to A or largest first.
  4. Pick the Language rules that match your text.
  5. Optionally ignore leading punctuation, trim lines, and remove empty or duplicate lines.
  6. Copy or download the sorted list.

Tips for better results

  • Use natural order for file names, version numbers and street addresses that contain numbers.
  • Numeric mode reads the first number on each line, so “Item 12.5 kg” sorts by 12.5; lines without a number go to the end.
  • Turn on “Ignore leading punctuation” to sort quoted titles or bullet points by their first real letter.
  • Sorting by length is handy for spotting unusually short or long entries in data you are checking.

Common use cases

  • Alphabetising a bibliography, glossary or list of guests.
  • Ordering exported file names or version tags correctly.
  • Ranking lines of a report by a number they contain.
  • Reversing a chronological log so the newest entry is at the top.

Common mistakes to avoid

  • Using Alphabetical mode for numbered items, which puts 10 before 9 because it compares digit by digit.
  • Sorting names in a language whose alphabet differs from English without changing Language rules.
  • Sorting lines that wrap across several lines, which splits a single entry into pieces. Remove the line breaks inside entries first.

Frequently asked questions

What is natural sort order?

Natural order treats runs of digits as whole numbers, so “chapter 2” comes before “chapter 10”. A plain alphabetical sort compares the character “1” with “2” and puts chapter 10 first.

Is sorting case-sensitive?

Not by default: “apple” and “Apple” sort together. With Case-sensitive on, uppercase sorts before lowercase of the same letter, and duplicate removal treats them as different lines.

How are accented letters sorted?

They follow the language rules you select. In English, É sorts with E. Some languages treat letters such as Å, Ñ or Ç as separate letters with their own place in the alphabet.

Can I sort by a column in CSV data?

This tool sorts whole lines. For sorting CSV by a particular column, use the CSV Filter and Sort tool, which understands quoted fields and headers.

Feedback & suggestions

Help us improve Sort Lines. We read every message.

Rating (optional)
Necessary
Required for security, language and theme preferences. Always on.