Advertisement

Sort lines by length

Sort your lines by character length, shortest first or longest first, with stable ordering for ties.

Sort Lines by Length

Paste lines, pick an order, and sort.

Advertisement

How length sorting works

Each line is measured in characters and lines are ordered by that length. The sort is stable: lines of equal length keep their original relative order, so nothing is randomly shuffled.

Why sort by length

Length sorting helps spot outliers in data files, arrange taglines or headlines by size, and tidy lists where the shortest or longest entries deserve attention first.

Sort Lines by Length FAQs

Does it count spaces in the length?
Yes. Length is the full character count of the line including spaces, so indented lines measure longer than their visible text.
What happens to lines of equal length?
They keep their original order. The sort is stable, so ties never get randomly rearranged.
Can I sort longest first?
Yes. Choose Longest first in the sort order dropdown before clicking the button.
Does it remove duplicate lines?
No. Duplicates are kept and sorted like any other lines; equal lines simply sit next to each other.
Is my text sent to a server?
No. The conversion runs entirely in your browser with JavaScript. Nothing you paste ever leaves your device.
Advertisement