Skip to content
100% local

Natural sort lines

Sort lines the way a person would, so "item2" comes before "item10".

Input
Output

Natural sort lines

Plain alphabetical sorting compares text character by character, so it puts "item10" before "item2" — the "1" simply comes before the "2" at that position. This tool sorts lines "naturally" instead, comparing the actual numeric value of any digits it finds, so "item2" correctly sorts before "item10", "file9" sorts before "file10", and "v1.9" sorts before "v1.10".

Paste a list of lines — file names, version numbers, product SKUs, log entries, spreadsheet rows exported as text — and the tool reorders them the way you would expect if you sorted them by hand. Under the hood it uses the browser's built-in Intl.Collator with the numeric option, which is the same comparison logic used by file managers and version-aware sorting elsewhere, so results match what you are used to seeing.

Switch between ascending and descending order with a single option. Sorting is case- and accent-insensitive: "Apple" and "apple" are treated as equal, and lines that compare equal keep their original relative order, so the result stays predictable even with mixed-case input. Windows (CRLF) and Unix (LF) line endings are handled the same way, and even very large lists — tens of thousands of lines — sort in milliseconds, with the exact timing shown in the tally under the output.

Everything runs locally in your browser. Your list is never uploaded anywhere, so it's safe to sort private data — internal file listings, customer IDs, unpublished version histories. Copy the sorted result, download it as a .txt file, or send it straight into another tool to continue cleaning up your list.

FAQ

How is this different from a regular alphabetical sort?
A regular sort compares text character by character, so "item10" sorts before "item2". This tool compares the numeric value of digit runs instead, so "item2" correctly sorts before "item10".
Does it ignore uppercase and lowercase differences?
Yes. Sorting uses base-letter comparison, so "Apple" and "apple" are treated as equal and keep their original relative order in the result.
Can I sort in descending order?
Yes. Switch the direction option from ascending to descending to reverse the sorted order.
What happens with lines that have no numbers at all?
They sort alphabetically, exactly as you would expect from a normal text sort — the numeric comparison only changes the outcome when digits are present.
Is my text uploaded anywhere?
No. Natural sorting runs entirely in your browser — your list never leaves your device.