Text tool / 05
Sort Lines
Sort line-based text ascending or descending with natural number ordering.
Sort Lines: TOEA applies locale-aware comparison to complete lines and can treat embedded digits as numbers. Runs 100% locally in your browser with zero server file uploads.
- Category
- Text tools
- Runs
- In your browser
- Cost
- Free · no sign-up
- Availability
- Ready to use
Runs entirely in your browser
Result
22 charactersNumbers that natural order gets wrong
Natural order reads each run of digits as a whole number, which puts file2 before file10 but does not understand everything. A minus sign is ignored as a sign, so -5 comes before -10 as if both were positive. Decimals are split at the point, so 1.5 comes before 1.25, because 5 is less than 25; pad decimals to the same number of places, 1.50, to fix it. Dates sort correctly only as year-month-day, such as 2024-03-09.
Before and after sorting
Lines that start with spaces, and blank lines, sort to the top, so a list pasted from a document often begins with a run of empty entries; trim lines first. Case and accents are ignored when comparing, and lines that compare equal keep their original order. A CSV header row is sorted along with the data, so cut it off first and put it back on top afterwards.
How to use it
- Paste one item per line.
- Choose direction and numeric behavior.
- Copy the sorted list.
Privacy & limitations
Text stays local. Sorting uses your browser locale and is not a database collation.
Related tools
Frequently asked questions
Does this upload my input?
No. The work happens in your current browser tab.
What is natural number order?
It places 2 before 10 instead of comparing each digit as plain text.
How are accented letters and ñ ordered?
Lines are compared with your browser locale's collation at base sensitivity: letter case and accents are ignored when ordering, so Árbol sorts beside arbol, and ñ is placed where your locale puts it rather than after z as raw byte order would.
Free tool · runs in your browser · no account required