List Tools

Sort by Length

Sort your lines by length, shortest to longest or longest to shortest.

PrivateYour text is processed on your device and never uploaded.
Input
Result
0 chars · 0 lines

Ordering lines by how long they are is not something a normal alphabetical sort can do.

Sort by Length arranges lines from shortest to longest, measuring real character length.

How to use Sort by Length

  1. Paste the lines you want ordered by length into the input box.
  2. Choose shortest-first or longest-first, and Sort by Length orders the lines by character count.
  3. Copy the length-sorted list, or download it as a .txt file.

Use cases

Good to know

Sort by Length measures each line by grapheme count, so accented letters and emoji count as one character, and orders the lines by that length. Lines of equal length keep a stable alphabetical order, and the direction can be reversed.

Frequently asked questions

How is length measured?

Lines are measured in grapheme clusters, so an accented letter or emoji counts as a single character.

What happens when two lines are the same length?

Lines of equal length are then ordered alphabetically so the result is predictable.

Can I put the longest line first?

Yes. A direction control switches between shortest-first and longest-first ordering.

Related List Tools