Sort Lines
Input
Options
Results
About This Tool
This tool was built as a quick and easy way to sort lines, which is a need that comes up surprisingly often.
Options
| Option | Description |
|---|---|
| Sort On | The method to use for sorting the lines. There are 3 options. You can sort alphabetically, on the length of the line, or using what's known as a natural sort. More on that below. And you can sort in either ascending or descending order. |
| Ignore Case | If checked, the sorting will be case-insensitive. |
| Strip blank lines | If checked, any lines that are empty or only contain whitespace will be removed before sorting. |
Natural Sort
Normally, when a computer sorts values it sorts everything as a string. That's why you'll often end up with something like this:
1something
10something
2something
3something
That, of course, probably isn't how you want things sorted if there's numbers in the string. That's where a natural sort comes in. If we took that same list of lines and sorted them using a natural sort, we'd get this:
1something
2something
3something
10something
That's a much more natural way to sort things, and that's what the "Natural Sort" option does.
Frequently Asked Questions
What's the difference between Ascending, Descending, and Natural Sort? Ascending and Descending sort every line as plain text (A before B, "10" before "2" because "1" comes before "2" character-by-character). Natural Sort instead reads embedded numbers as whole numbers, so "2something" correctly comes before "10something" — the order a person would expect.
Does sorting remove duplicate lines? No — this tool only reorders lines, it doesn't remove duplicates. If you need to deduplicate a list, paste the sorted output into the remove duplicate lines tool.
Can I sort lines by length? Yes — choose "Length: Ascending" to put the shortest lines first, or "Length: Descending" for the longest first. This is useful for finding outliers in a list, like an unusually long or short entry.
Does Ignore Case affect the final order of identical-looking lines? When Ignore Case is checked, "apple" and "Apple" are treated as equal for sorting purposes, so their relative order depends on their original position in the input rather than letter casing.
Is there a limit to how many lines I can sort? No hard limit — this tool runs entirely in your browser. Very large inputs (tens of thousands of lines) may take a moment to sort depending on your device.