TTKTheTextKit

Sort Lines

Paste a list and choose a sorting method: alphabetical A to Z, reverse Z to A, shortest first by line length, or longest first. Numbers inside lines sort by value, so item2 comes before item10, and you can ignore case, remove blank lines and keep your original line endings. The tool sorts instantly and lets you copy the result with one click. Useful for glossaries, keyword lists, CSV columns, or code arrays.

Related Tools

[3 suggestions]

Guides for the Sort Lines

About the Sort Lines

The Sort Lines tool splits your input into lines and sorts them with one of four methods. Alphabetical sorting uses your browser's language rules (Intl.Collator), so accented letters sort next to their base letter and the order follows your language: in German an a with two dots sorts with a, in Swedish it sorts after z. By default digits compare by value, so item2 comes before item10 and v1.9 before v1.10, and upper and lower case are treated as the same letter. Switch the case option off to get plain code order, where every capital letter comes before every lowercase letter, as in the sort command of a programming environment. Length sorting counts characters, with an emoji counted as one, and lines of the same length are sorted alphabetically. Blank lines sort to the top in A to Z order unless you choose to remove them. A final line break stays at the end instead of turning into an empty first line, and the line ending of your text, LF or CRLF, is kept. Lines that compare as equal keep their original order. Typical uses include alphabetizing glossary terms, organizing CSS property declarations, sorting dependency lists, and reordering data exported from spreadsheets.

Is the sort case-sensitive?▾

By default no: apple and Apple sort together, and lines that differ only in case keep their original order. Switch off Ignore case to sort by code order, where every capital letter comes before every lowercase letter.

Why does item10 come before item2 in some sorters?▾

Plain alphabetical sorting compares character by character, and 1 comes before 2. This tool compares runs of digits by value by default, so item2 comes before item10. Switch the option off if you want the strict letter-by-letter order.

Can I sort by line length?▾

Yes. Choose Shortest First or Longest First to arrange lines by character count. An emoji counts as one character, and lines of equal length are sub-sorted alphabetically.

What happens with blank lines?▾

They are sorted like any other line, so in A to Z order they appear at the top. Tick Remove blank lines to drop them, including lines that hold only spaces.

Why does the order differ from my spreadsheet or another language?▾

Alphabetical order depends on the language. The tool uses your browser's language, so the same list can sort differently in German and Swedish. Case and accents also matter, so set the options to match the program you compare with.