MSRX Tools

Sort Lines

Alphabetical, numeric or natural sort, forwards or back.

Everything runs inside your browser. Your files never leave your device.

Input

Result

The result appears here as you type.

Ask about Sort Lines

Questions about what this tool does, which option to pick, or what it can and cannot handle.

The question you type here is sent to an AI provider to be answered — your files and whatever you put in the tool above are not, and the assistant cannot see them. Answers are generated and can be wrong. The tool itself is not guessing: it runs deterministic code on your device.

About the Sort Lines

Sorting a list is one of those operations that is trivial in a terminal, awkward in a spreadsheet and oddly missing from most text editors. This does it on whatever you paste: alphabetically, in reverse, or numerically, with optional case sensitivity.

The numeric option is the one that matters more than it looks. Sorting numbers as text puts 10 before 2, because comparison happens character by character and "1" comes before "2". That is correct string behaviour and almost never what anyone wants from a list of quantities, versions or ports. Switching to numeric sorting reads each line as a number and orders it properly.

Case sensitivity changes where capitals land. A case-sensitive sort puts every capital letter before every lowercase one, because that is their order in the character set, so "Zebra" comes before "apple". Case-insensitive folding gives the ordering a person expects from an index. Neither is wrong; they answer different questions, and the default here is the human one.

Sorting is also the fastest way to find duplicates without a dedicated tool: identical lines end up adjacent, and a repeated entry that was invisible in a thousand-line file becomes obvious. If removing them is the actual goal, the deduplication tool on this site does it in one step and reports how many went.

Everything runs in this tab, which is the practical reason to use a web page for this at all — a list of customer email addresses or internal hostnames is exactly the kind of thing that should not be pasted into a service that keeps a copy.

How to use it

  1. 1Paste your list, one item per line.
  2. 2Choose the direction and whether the sort should be alphabetical or numeric.
  3. 3Switch on numeric ordering for anything that is a quantity, a version or a port.
  4. 4Copy the sorted result, or send it to the deduplication tool if repeated lines are what you were looking for.

Questions

Why does 10 sort before 2?
Because a text sort compares character by character, and "1" precedes "2". Switch on numeric sorting and each line is read as a number instead, which orders them the way you expect.
Where do capital letters end up?
In a case-sensitive sort, before all lowercase letters, since that is their position in the character set. Case-insensitive sorting folds them together and produces the ordering you would find in an index.
Can it sort by a column rather than the whole line?
Not here — it compares whole lines. For column-based ordering, a spreadsheet or the CSV tools on this site will do better, since they understand where the fields begin and end.
What happens to blank lines?
They sort to the top in ascending order, being empty strings. Removing them first with the deduplication tool usually gives a tidier result.