Sort lines

Client-side only. Sort runs in this tab. Nothing is uploaded.

Mode
0Original lines
0Output lines
0Empties skipped

When line order is the bug

You already have the values. The paste is just out of order: filenames in a PR checklist, hosts from two scans, tags from a dump, or bullets you want alphabetical before you commit. Paste the list, pick a mode, hit Sort, copy the result.

This page reorders whole lines in the browser. It does not parse CSV columns, run SQL, or sync with a sheet.

Sort modes compared

ModeWhat it doesBest for
A–ZAlphabetical ascending (localeCompare)Names, tags, plain word lists
Z–AAlphabetical descendingReverse dictionary order
Reverse orderFlips the current line order. No alpha sortUndoing a bad paste order, last-to-first logs
NaturalNumeric-aware: digit runs compare as numbersfile1 / file2 / file10, host-2 / host-10

Plain A–Z vs natural sort

Leave the sample paste. With Natural and default options (case off, trim on, ignore empty), the filename block should land as:

file1.txt
file2.txt
file10.txt

Switch to A–Z and re-run. Plain string sort often puts file10.txt before file2.txt because 1 beats 2 at the first differing character. That is why natural mode exists for versioned filenames and numbered hosts.

With case sensitive off, Apple and apple sit next to each other under a case-insensitive key. The output still shows the original spelling of each kept line.

Options that change the result

Limits

FAQ

Does sorting upload my text?

No. Sorting runs in JavaScript in this tab. ToolPetal has no server step for the sort lines tool.

What is natural sort?

Natural (numeric-aware) sort compares digit runs as numbers, so file2.txt comes before file10.txt. Plain A–Z treats them as character strings, so file10.txt often sorts before file2.txt.

Is case sensitive on by default?

No. Case sensitive is off by default so Apple and apple group together under a friendlier alpha order. Turn it on when you need uppercase and lowercase treated as different keys.

Does remove duplicates keep first or last?

After the chosen sort, duplicates are collapsed in the sorted order and the first occurrence of each compare key is kept. Compare keys still respect case and trim options.