Skip to content
Toolspire

Text Tools

Sort Lines

Sort Lines is part of Toolspire and is ready as soon as this page loads. Upper case sorts before lower case in this Unicode order, so C comes before a. Numbers are not sorted numerically: 10 comes before 2.

Runs in this tabFreeNo account

On this page

What you can do here

One line, one item

Commas do not split a line. “Ana Lopez” stays together.

Case is significant

C is not folded into c. A dictionary order would differ.

The source box is not replaced

The sorted copy is the result. Shuffle and sort can be compared.

The sequence

How to use the Sort Lines

  1. 1

    Put one item on each line

    A sentence with no line break is one item.

  2. 2

    Expect capitals first

    If you wanted a, b, C regardless of case, this order will surprise you. It is the code-point order.

  3. 3

    Do not use it for 1, 2, 10

    Those sort as text. 10 comes first.

Worth knowing

  • Sort Lines on Toolspire: lines are ordered with locale-independent code-point order, after trimming.
  • b, a, C becomes C, a, b, because the code point of C is before a.
  • Blank lines are dropped, not sorted to the top as empty strings you still see.
  • 10 sorts before 2. This is not a numeric sort.

Alphabetical here means code points

The sort compares the trimmed lines as text. Uppercase letters have smaller code points than lowercase letters, so C precedes a. That is stable and boring, and it is not the order a phone book uses when it ignores case. Numeric strings are text too, so “10” is less than “2” because “1” is less than “2”. Blank lines are removed so they do not form a block of empties at one end.

FAQ

Questions about Sort Lines

Where does Sort Lines run?

Sort Lines runs in this tab on Toolspire. What you type or drop in is not sent to us and is not stored on a server.

How do b, a and C sort?

C, then a, then b.

Why is C before a?

The comparison is case-sensitive and uses code points. C comes before any lowercase letter.

Will 2 come before 10?

No. As text, 10 comes first.

Are blank lines kept?

No. They are dropped.

Keep going

Open the full directory

Last updated Report a problem or suggest a feature