- Home
- Tools
- Text Tools
- Sort & Dedupe Lines
- Sort Lines by Length
Sort Lines by Length
Put the lines of a text in order of length, shortest first. An accented letter or an emoji counts as one character.
- Lines in
- 0
- Lines out
- 0
- Duplicates
- 0
How length is measured
- Before
- strawberry fig crème brûlée kiwi pear
- After
- fig kiwi pear strawberry crème brûlée
The length of a line is the number of characters a reader sees, spaces included. An accented letter counts once, whether the text stores it as one character or as a letter with a separate accent. So does an emoji, even one that is built from several parts, such as a flag. That makes "crème brûlée" 12 long.
Lines of the same length stay in the order you entered them: kiwi was above pear, and it still is. To get lines of equal length in alphabetical order, sort alphabetically first, press Use as input and then sort by length.
Spaces at the start and end of a line would count towards its length, so they are trimmed first. Switch that off when those spaces matter. A tab counts as one character.
For the longest line on top, choose "By length, longest first" under Order.
Sorting, removing duplicates, numbering and adding a prefix can be combined on the Sort & Dedupe Lines page, which also remembers your settings.