Sort Lines

Direction

Paste a list of lines, names, emails, URLs or SKUs, and this tool orders them alphabetically. Choose the direction (A-Z or Z-A), decide whether the comparison is case-sensitive, and optionally trim surrounding whitespace and drop empty lines before sorting. The comparison is by character code point, so it is fast and predictable rather than language-aware.

How sorting works

  1. 1

    Paste your lines

    One entry per line. Trailing spaces and blank lines can be trimmed or removed first.

  2. 2

    Choose the direction

    A-Z (ascending) or Z-A (descending). Z-A is simply the ascending order reversed.

  3. 3

    Set the options

    Turn case-sensitive matching on or off, and decide whether to trim whitespace and remove empty lines.

  4. 4

    Copy the sorted result

    Click Sort Lines, then copy the ordered list.

How the comparison works

Lines are compared character by character using their underlying character codes. There is no numeric, natural, length or locale-aware mode, so the behaviour is simple and consistent.

Option Behaviour
Case-insensitive (default) Apple and apple are treated as equal; the original order breaks ties.
Case-sensitive Uppercase letters sort before lowercase, because A (code 65) comes before a (code 97).
Direction A-Z Ascending by character code.
Direction Z-A The A-Z order reversed.
Trim whitespace Leading and trailing spaces are removed before sorting.
Remove empty lines Blank lines are dropped from the result.

What this sorter does not do

  • No numeric or natural sort. file10 sorts before file2, because the second character 1 beats 2. For version-style ordering you need a natural-sort tool.
  • No de-duplication, no shuffle, no sort by length. Identical lines are kept.
  • Not language-aware. Accented and non-Latin letters are ordered by their byte values, so they fall after the plain A-Z / a-z range rather than next to the base letter a reader would expect.

Sorting names in different languages

Because the comparison is by character code, keep in mind:

  • Spanish. ñ sorts after z, not between n and o.
  • German. ä, ö, ü and ß sort after z; they are not folded to a/o/u/ss.
  • Swedish. å, ä, ö also fall after z, which happens to match Swedish order for these letters.
  • Turkish. The dotted and dotless i are not treated as distinct letters, and case-insensitive matching uses ASCII rules, so İ and ı do not fold the way Turkish expects.

If you need dictionary-accurate ordering for a specific language, sort in a spreadsheet or a locale-aware tool instead.

Lexicographic vs natural order

A list like file1, file2, file10 sorts as file1, file10, file2 here, because 1 before 2 is decided at the second character. That is standard lexicographic order. Natural sort, which reads the digit runs as numbers to give file1, file2, file10, is a different algorithm this tool does not apply.

Frequently Asked Questions

Uppercase letters have lower character codes than lowercase ones (A is 65, a is 97), so they come first. With case-sensitive matching off, upper and lower case are treated as equal and the original order breaks ties.

No. Lines are compared as text, character by character, so 10 sorts before 2 and file10 before file2. For true numeric or version ordering, use a natural-sort tool or a spreadsheet.

No. Each whole line is treated as a single key. For column-based sorting, use a spreadsheet or sort -k at the command line.

No. It can trim whitespace and drop empty lines, but identical lines are kept. Remove duplicates with a dedicated tool first if you need a unique list.

Related Tools

Tool available in other languages