Sort Lines

Sort the lines of a text block using JavaScript's locale-aware string comparison. The operation changes order but does not trim or otherwise normalize the lines.

What this tool actually changes

The implementation splits on CRLF or LF and calls Array.sort() with localeCompare(). Because comparison is locale-aware, ordering can differ from a byte-wise ASCII sort and may vary with locale behavior.

Edge cases to know

Whitespace remains part of each line. Blank lines remain in the input and participate in sorting. If you need Unix-style byte or ASCII ordering, use an appropriate command-line or custom workflow instead.

Example

Input:
delta
alpha
charlie
beta

Output:
alpha
beta
charlie
delta

Good use cases

Alphabetizing lists, preparing deterministic review material, organizing identifiers, and getting pasted data into a consistent order.

Workflow tip

Choose the operation that matches your intent. If whitespace is causing unexpected duplicates, normalize it before deduplicating rather than assuming the duplicate operation should ignore formatting.

Frequently asked questions

Does sorting trim whitespace?

No. Lines are sorted as they are; whitespace remains part of each string.

Is this the same as Unix sort?

Not exactly. This browser tool uses JavaScript localeCompare(), while Unix sort has its own locale and option semantics.

Does it remove duplicates?

No. Sorting changes order only.