Skip to content
AdeptBay

How to use the Sort Lines

Last verified 2026-08-08 · about 5 minutes to read

The short version

  • 1.Paste your list. One item per line. Any line ending works.
  • 2.Choose the order. Alphabetical uses natural sorting, so "item 2" comes before "item 10".
  • 3.Copy the result. Or download it as a text file if the list is long.

Why this is worth getting right

Two things separate this from a one-line JavaScript sort. First, numeric-aware collation, so item 2 precedes item 10. Second, Intl.Collator for accents and non-Latin scripts, so élan lands next to elan rather than at the end of the list. Both are what a person means by "alphabetical" and neither is what Array.prototype.sort does by default.

Method 1 — use the Sort Lines on this site

The fastest route. It runs entirely in your browser, so nothing is uploaded and there is no queue to wait in. No account is needed and there is no daily limit.

  1. Paste your list. One item per line. Any line ending works.
  2. Choose the order. Alphabetical uses natural sorting, so "item 2" comes before "item 10".
  3. Copy the result. Or download it as a text file if the list is long.

Open the Sort Lines

Method 2 — do it without this site

Worth knowing, because a tool you cannot replace is a dependency rather than a convenience. Most tasks in the text division have a command-line or built-in equivalent; it is usually more setup and less convenient, but it works offline and it is scriptable, which matters once you are doing something a hundred times instead of once.

What this tool will not do

Every tool has an edge. These are ours for sort lines, stated up front so you find out here rather than halfway through a deadline:

  • Sorting is by whole line. Sort by a CSV column by extracting the column first.
  • Collation follows the browser's locale. A German and a Swedish browser will order ä differently — correctly, in both cases.

Questions people ask

Why does "item 2" come before "item 10"?

Because this sort is numeric-aware. A plain string sort compares character by character, so "1" beats "2" and you get item 1, item 10, item 2. Natural sorting reads runs of digits as numbers, which is what people actually mean by alphabetical.

How are accented characters sorted?

Through Intl.Collator, the browser's own locale-aware comparison. "élan" sorts next to "elan" rather than after "z", which is what a byte-order sort would do because é has a higher code point than every unaccented Latin letter.

What happens to lines with no number in numeric mode?

They move to the bottom, in alphabetical order among themselves. Scattering them randomly through the result — which is what NaN comparisons do if unhandled — makes the output impossible to scan.

Is the shuffle actually random?

It is a Fisher-Yates shuffle drawing from crypto.getRandomValues, with rejection sampling to remove modulo bias. Every permutation is equally likely, which is not true of the common "sort by Math.random()" one-liner.

Does sorting remove duplicates?

No. Sorting and deduplication are separate operations here so you can do one without the other. Run the Remove Duplicate Lines tool first if you want both.

Open the Sort LinesAlphabetical, numeric, by length or shuffled — with correct accent handling.