Toolstia / Sort lines by length

sort lines by length

Put a list in order of how long each line is. Measure by characters or by words, and choose how lines of equal length are ordered.

How it works

  1. Paste your lines.
  2. Choose shortest or longest first, and characters or words.
  3. Copy the sorted list.

Characters or words

Characters counts each visible code point, so an emoji counts as one. Words splits on spaces.

Equal lengths

Lines of equal length keep their original order by default, or you can sort them A to Z.

Cleaning options

Remove empty lines, or trim spaces around each line before measuring.

Uses

Finding the longest headline, checking which titles will be cut off, ordering a word list for a puzzle or spotting odd one-off lines in data.

Questions

Is it a stable sort?

Yes. Lines that tie keep the order they had.

Does it handle Windows line endings?

Yes. They are treated as ordinary line breaks.

Is my list uploaded?

Everything happens in your browser, and nothing you enter is sent anywhere.