Line sorter

Paste a list of names, products or keywords and sort it alphabetically. The tool uses the language-aware ordering built into your browser (Intl.Collator) rather than raw character codes, so “Émile” lands next to “eagle” and “أحمد” near “احمد”. Use it to sort lines alphabetically from A to Z or from Z to A.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Paste your text into the input box, one item per line.
  2. Choose the sorting rules (Arabic, English or automatic by page language) and ascending or descending order.
  3. Turn on numeric sorting if lines contain numbers such as “item 2” and “item 10”, and pick the other options.
  4. Press “Sort”, then copy the result or download it as a text file.

Example

The built-in example: منتج ١٠, item 10, تفاح, Banana, منتج ٢, item 2, apple, برتقال, منتج 3.

With English rules, ascending and numeric sorting it becomes: apple, Banana, item 2, item 10, برتقال, تفاح, منتج ٢, منتج 3, منتج ١٠. With Arabic rules the Arabic lines come first: برتقال, تفاح, منتج ٢, منتج 3, منتج ١٠, then apple, Banana, item 2, item 10. Without numeric sorting “item 10” comes before “item 2” and “منتج ١٠” before “منتج ٢”.

Limits and caveats

  • Tested with 100,000 mixed lines (about 1.5 MB): sorting takes about a second on a desktop computer, and the browser text box itself needs several seconds to display a paste of that size. With large texts sorting only starts when you press “Sort”, and the preview shows the first 300 lines while copy and download contain the full result. Above about 4,000 lines or 150,000 characters the text box shows every line in one direction (taken from its first letter) instead of a direction per line, because per-line direction makes the browser extremely slow at that size.
  • Numeric sorting compares runs of whole digits only: it does not understand minus signs, decimals (1.5 comes before 1.25) or thousands separators.
  • The exact order comes from the Unicode CLDR data in your browser, so small details can differ between browsers and versions.
  • Duplicate removal drops exactly identical lines only (after the case and leading-space options). A word with diacritics and the same word without them are different lines.

Questions about this tool

How are Arabic and Latin lines ordered relative to each other?

With Arabic rules, Arabic lines come before Latin lines; with English rules, Latin lines come before Arabic ones. In both cases lines that start with a space, punctuation or a symbol come first, then lines that start with a digit, then letters. Descending order reverses all of that.

Does numeric sorting understand Arabic-Indic digits (٠ to ٩)?

Yes. When numeric sorting is on, Arabic-Indic (٠ to ٩) and Persian (۰ to ۹) digits are converted to 0-9 for the comparison only, so “بند ٢” comes before “بند 3” and “بند ١٠”. The line itself is output exactly as you wrote it.

What does the case-sensitive option do?

Without it, apple and Apple count as equal and stay in the order they appeared in your text. With it, the lower-case form comes first (apple, then Apple) and the two stay next to each other. This is not ASCII order, which would put every capital letter before every small one.

How do I sort a list alphabetically?

Paste the list with one item per line, choose the sorting rules and “Ascending (A → Z)”, then press “Sort”. With English rules, banana, Apple, cherry becomes Apple, banana, cherry: capital and small letters are sorted together instead of all capitals first. Copy the result or download it as a text file.

How do I sort lines in reverse alphabetical order (Z to A)?

Choose “Descending (Z → A)” and press “Sort”. The names محمد, سارة, أحمد, خالد sorted with Arabic rules then become محمد, سارة, خالد, أحمد. In mixed text, descending reverses the whole order, including whether Arabic or Latin lines come first.