Sort Lines
Sort a list alphabetically, naturally (item 2 before item 10) or by line length, ascending or descending, with the right letter order for Turkish.
Up to 500,000 characters. Each line break starts a new item.
Alphabetical follows the language rule; natural also orders numbers by value (item 2 before item 10); length sorts by number of characters.
No: a and A are equal and keep their input order. Accents always count, so c and ç stay different. Yes: a comes before A. Does not apply to sorting by length.
Spaces are removed from the output as well.
Empty and whitespace-only lines are kept at the top (ascending) or bottom (descending), or removed.
Decides where letters such as ç, ğ, ı, ö, ş, ü and ä are placed. Defaults to the page language.
- Lines
- 0
How it works
Paste one item per line and pick how to compare them. The result updates as you type. A line break of any kind (Windows CRLF, Unix LF, old Mac CR, Unicode line and paragraph separators) ends a line, and the output is always joined with plain LF. One break at the very end of the text does not create an extra empty line.
There are three ways to compare:
- Alphabetical uses the browser's collator for the chosen language, not the raw character codes. Letters are ordered the way a dictionary in that language orders them. Digits are compared as text, so "item 10" comes before "item 2".
- Natural is the same collation with one change: each run of digits is compared as a number. "item 2" now comes before "item 10". Numbers with leading zeros such as "a1" and "a01" are equal as numbers and keep their input order. Only digit runs are interpreted: a minus sign or a decimal point is an ordinary character, so this is not a tool for sorting negative or decimal numbers.
- Line length counts code points. An astral emoji counts as 1; a family emoji joined with zero-width joiners, or a letter written as a base letter plus a combining accent, counts as several. It is not a count of what you see on screen. Lines of equal length keep their input order.
The sort is stable: lines that compare as equal always stay in the order you gave them.
Why the language rule matters
Code-point order, which is what many simple sorters use, puts every capital letter before every lowercase letter and every non-ASCII letter after "z". For Turkish that means Ç, Ğ, Ö, Ş and Ü end up at the bottom. The language rule fixes this: Turkish places ç after c, ğ after g, ö after o, ş after s, ü after u, and sorts dotless ı before i. The English and German rules give the same order for ä, ö, ü and ß (they sit beside a, o, u, and ß sorts like ss), so the choice only matters for Turkish. The rule defaults to the language of the page and you can change it for any list. It affects only the order, never the text of the page.
Case and accents
With Case sensitive set to No, case is ignored but accents are not: "c" and "ç" stay different letters, and "a" and "A" tie. With Yes, lowercase precedes uppercase of the same letter. Under the Turkish rule, "I" and "ı" tie when case is ignored, and so do "İ" and "i".
Examples
| Input lines | Settings | Result |
|---|---|---|
| item 10 item 2 item 1 | Alphabetical | item 1 item 10 item 2 |
| item 10 item 2 item 1 | Natural | item 1 item 2 item 10 |
| v2 v10 v1 | Natural, descending | v10 v2 v1 |
| b A a B | Case sensitive: No | A a b B |
| B b A a | Case sensitive: Yes | a A b B |
| ç d c C | Case sensitive: No | c C ç d |
| a A b | Descending, case ignored | b a A |
| i ı j h | English rule | h i ı j |
| i ı j h | Turkish rule | h ı i j |
| st ß sr ss | German or English rule (same result) | sr ss ß st |
| ccc b aa d bb | Line length, ascending | b d aa bb ccc |
| ab 😀 abc | Line length, ascending | 😀 ab abc |
| b (empty) a (empty) c | Ascending, keep empty lines | (empty) (empty) a b c |
| b (empty) a | Descending, keep empty lines | b a (empty) |
Things to watch for
- Descending is not a mirror image when lines tie. Equal lines keep their input order in both directions. If you need the exact reverse of an ascending result, sort ascending and read it from the bottom.
- Edge spaces change the order. A leading space sorts before every letter. Lists pasted from web pages, PDFs or spreadsheets often carry non-breaking spaces or zero-width characters at the ends; turn on Ignore leading and trailing spaces. With it on, the output lines are trimmed too. Characters inside a line, and invisible characters such as the soft hyphen or bidirectional marks, are left alone and can still affect the order.
- Whitespace-only lines are blank lines. They are grouped with the empty ones even when trimming is off. With trimming off they come out as they were; with trimming on they come out empty.
- Length mode ignores case. The Case sensitive option is hidden for it, because a length does not depend on letter case. With trimming on, the trimmed length is compared.
- Order depends on the browser's collation data. The language rules come from the Unicode locale data built into your browser. Ordinary letters and digits in the three languages offered here follow well-defined rules, but the placement of punctuation, symbols and rare scripts can depend on the browser and its version. If the exact position of such characters matters, check the result in the browser you will rely on.
- Only English, Turkish and German rules are offered. Other languages with their own letter order, such as Swedish, are not covered, and there is no alternative German ordering such as the phone-book variant.
- Sorting is not deduplication. Equal lines stay in the output. To drop repeated lines, remove duplicates in a separate step.
- Size. Up to 500,000 characters are accepted; above that the result stays empty and an error is shown.
- Your text stays on your device. Lines are sorted in the browser, nothing is uploaded or saved.
Frequently asked questions
Last updated: 10/11/2026
Related tools
Remove duplicate lines from a list, keep the first or last occurrence, and ignore letter case, surrounding spaces and invisible characters if you need to.
Convert text to UPPERCASE, lowercase, Sentence case or Capitalize Each Word, with the correct rule for Turkish and German letters.