Length Sort sorts the lines of your text by length, from shortest to longest or from longest to shortest. Paste your lines, click the button and copy the sorted list. It is free and runs in your browser.
Sort direction: Ascending
Sunset painted the sky in vivid hues and lighting. Bookstores are cool. The old clock in the hall chimed at midnight. Rain fell. She walked home slowly through the quiet park. We left early.
Rain fell. We left early. Bookstores are cool. The old clock in the hall chimed at midnight. She walked home slowly through the quiet park. Sunset painted the sky in vivid hues and lighting.
Bookmark: press Ctrl+D (Windows) or Cmd+D (Mac) to save this tool.
This tool sorts the lines of your text by length. Each line is kept whole, and only the order of the lines changes.
Choose Ascending to put the shortest line first, or Descending to put the longest line first. The length is the number of characters in the line, including spaces. Lines of the same length keep their original order, and empty lines are removed.
Use it to find the shortest or longest lines in a list, to order words or titles by size, or to tidy a list so that the lines get steadily longer.
Each example shows your lines before and after sorting by length. The direction is shown in the Case column.
| Case | Before | After |
|---|---|---|
| Shortest first (ascending) | Sunset painted the sky in vivid hues and lighting. Bookstores are cool. The old clock in the hall chimed at midnight. Rain fell. She walked home slowly through the quiet park. We left early. | Rain fell. We left early. Bookstores are cool. The old clock in the hall chimed at midnight. She walked home slowly through the quiet park. Sunset painted the sky in vivid hues and lighting. |
| Longest first (descending) | Sunset painted the sky in vivid hues and lighting. Bookstores are cool. The old clock in the hall chimed at midnight. Rain fell. She walked home slowly through the quiet park. We left early. | Sunset painted the sky in vivid hues and lighting. She walked home slowly through the quiet park. The old clock in the hall chimed at midnight. Bookstores are cool. We left early. Rain fell. |
| Words by length | banana fig apple kiwi | fig kiwi apple banana |
| Same length keeps its order | cat dog ox ant | ox cat dog ant |
| Spaces are counted | a b c abcd ab | ab abcd a b c |
| Empty lines are removed | long line hi | hi long line |
Finding the shortest or longest lines, ordering words or titles by size, and tidying lists so the lines get steadily longer or shorter.
Put one item on each line. Spaces and punctuation count towards the length. Lines of the same length keep their original order. Empty lines are removed, and repeated lines are kept. The result replaces your text, so use Undo if you need the original.
To sort A to Z try Alphabetical Sort. To see the length of each line try Find the Length of Each Line. To remove repeated lines try Remove Duplicate Lines.
It sorts the lines of your text by their length. You can put the shortest line first (ascending) or the longest line first (descending).
Paste your lines, one on each line, choose Ascending or Descending in Sort direction, then click Length Sort. The sorted lines replace the text in the box. Click Copy to use them, or Undo to go back.
Ascending puts the shortest line first and the longest line last. Descending does the opposite, with the longest line first.
By the number of characters in the line, including spaces and punctuation. The line a b has 3 characters.
They keep the order they had in your text, in both Ascending and Descending.
No. Empty lines and lines with only spaces are removed, so the result is a clean list.
No. A line that appears twice is kept twice. To remove repeated lines use Remove Duplicate Lines.
Yes. Put one word on each line. To sort the words of a sentence, first put each word on its own line.
Yes. It is free, needs no account and runs in your browser, so your text is not uploaded to a server.
Last updated: 10 November 2026