Skip to content
Este site está disponível em português
Toolbench

Try: compress pdf, iphone photo, 15% of 240

    Sort Lines

    Alphabetical, reverse or by length, ordered naturally.

    What comes out

    The answer appears here as you type.

    Guide: Natural ordering, not ASCII ordering2 min read

    Natural ordering, not ASCII ordering

    A plain string sort puts item10 before item2, because it compares character by character and 1 comes before 2. Technically correct, and never what anyone wanted.

    This compares embedded numbers as numbers, so item2 comes before item10. It is the difference between a sorted list and a list you have to fix by hand afterwards.

    Sorting by length

    Less obvious and genuinely useful: it surfaces the outliers. The shortest entries are usually the truncated ones and the longest are usually the ones with something stuck to the end.

    For cleaning a list you were given rather than one you made, it is often the first thing worth looking at.

    Case affects where things land

    With case respected, capitalized entries can group separately from lowercase ones depending on the comparison. With it ignored, Apple and apple sit together.

    For a human-readable list, ignoring case is usually what you want. For anything a machine will read back, respect it.

    Nothing is sent anywhere

    Everything on this page happens in your own browser. No request is made, nothing is stored between visits, and the page keeps working with the connection switched off.

    Frequently asked questions

    Are blank lines removed?

    Trailing blank lines are dropped so the output does not end in emptiness. Blank lines between entries sort to the top, which is usually the signal that the list needs cleaning first.

    Can I sort numbers properly?

    Yes. Numeric comparison is built into the ordering, so a list of plain numbers sorts numerically rather than as text — 2 before 10, not the other way round.

    Does it sort accented letters correctly?

    It uses locale-aware comparison, so accented characters sort next to their base letter rather than after Z, which is what a byte-order sort does.

    Is my list sent anywhere?

    No. Everything happens in this tab.

    Same drawer