Sort lines by length
Order the lines of a list from shortest to longest, or the other way around.
Sort lines by length
Paste a list and this tool reorders its lines by character length instead of alphabetically, from shortest to longest or longest to shortest. It's built for tidying keyword lists before a title check, finding the longest or shortest entry in a set of names, ranking log lines by how much they say, or simply making an uneven list easier to scan.
Choose "Shortest first" or "Longest first" from the order option. Length is counted in characters, including emoji and accented letters, each counted as one character rather than as the raw bytes or code units behind them. "Trim whitespace before measuring" ignores leading and trailing spaces when comparing lengths — useful when a list was copied with inconsistent indentation — but the original line, spaces included, is always what ends up in the output; only the measurement changes.
Lines of equal length keep their original relative order by default, since a plain sort is already stable for ties. Turn off "Keep original order for equal lengths" to break those ties alphabetically instead, which is handy when you want a fully deterministic order rather than one that depends on where each line started. Windows (CRLF) and Unix (LF) line endings are handled the same way, and empty lines are preserved and sort to the front in ascending order.
Everything runs locally in your browser: the list is never uploaded, so it's safe to sort private data such as customer names, internal identifiers or draft copy. The tally under the output shows the line count and the total character count, updating as you type, and you can copy the result or download it as a .txt file when you're done.