Sort lines alphabetically using locale-aware localeCompare. Every line—including blank lines—is sorted as a full string, which normalizes unordered lists from agent tool output, log extracts, and copy-pasted configuration snippets.
How it works
The input is split on newline characters without trimming individual lines. The resulting array is sorted with the browser's localeCompare, which respects the active locale for case and accent ordering. The sorted lines are joined back with \n and shown in the output field. Original line endings other than \n are normalized during splitting.
When to use it
- Normalize hostname or ID lists before diffing or set operations
- Prepare bullet lists for comparison with the unique-lines tool
- Order log extracts alphabetically for human review or reporting
- Sort environment names, feature flags, or CSV-derived rows line by line
Example
Input charlie\nalpha\nbravo becomes alpha\nbravo\ncharlie in the output textarea. Blank lines are sorted among other lines according to locale rules.
Limitations
Sorts lexicographically, not numerically—so 10 sorts before 2. Case sensitivity follows the browser locale. Multi-column or tab-separated rows are sorted as whole lines, not per column. For numeric ordering, pad numbers or use a dedicated numeric sort elsewhere.