Report

Help us improve this tool

Sort Lines by Length

Reorder lines by length ascending or descending with alphabetical tie-breaking options.

O M T

Sort lines by character length

Lists ordered by length help when reviewing log excerpts, survey answers, or UI copy variants. Choose shortest first or longest first, decide how to break ties (alphabetical vs. original order), and optionally drop blank lines before sorting. Results update live as you edit.

Tie-breaking options

When two lines share the same length, alphabetical tie-breaking sorts predictably for reports. Stable tie-breaking keeps the relative order from your source paste, useful when length ties should not reshuffle semantically grouped rows.

For alphabetical sorting regardless of length, use Sort Text Lines. To find the single longest row, try Find Longest Line.

Frequently Asked Questions

Are tabs or trailing spaces included in length?

Yes. Length is the raw JavaScript string length per line, including spaces and tabs, unless you trim lines elsewhere first.

Does sorting change line endings?

Output is joined with Unix newlines. Paste from Windows files still sorts correctly; copied output uses \n between lines.

Can I sort by word count instead?

This tool measures characters only. For word-based metrics, use Character Word Counter on individual lines or split text first.