GALAXY OF TOOLS

TEXT SECTOR

Sort Lines

Sort lines A→Z, Z→A, naturally (file2 before file10), by number, length or word count — or shuffle them.

Order

Runs entirely in your browser. Nothing you enter or upload is sent to a server.

Sort lines of text alphabetically, naturally or by number

The Sort Lines tool puts any list in order in one step. Paste names, keywords, file names, prices or a column copied from a spreadsheet and sort the lines alphabetically from A to Z or Z to A, in natural order (so “Chapter 2” comes before “Chapter 10”), by the number in each line, by length or by word count. You can also reverse the current order or shuffle the lines randomly.

Sorting is language-aware: accented letters such as É, ñ and ö are placed next to their base letters instead of after Z, which is what simple sorting in many programs does. Optional clean-up removes empty lines and duplicates as it sorts. Everything happens in your browser, so even private lists stay on your device.

How to use the Sort Lines

  1. Paste your text into “Lines to sort”, one item per line.
  2. Choose how to “Sort by”: Alphabetical, Natural, Numeric value, Line length, Word count, Reverse current order or Random shuffle.
  3. Pick the order — for example A → Z or Z → A, smallest or largest first.
  4. Adjust the options: case-insensitive, language-aware, remove duplicates and remove empty lines.
  5. Copy or download the sorted lines. In shuffle mode, press “Shuffle again” for a new random order.

Sort Lines features

Seven ways to sort

Alphabetical, natural, numeric, by length and by word count in either direction, plus reverse and random shuffle.

True natural sort

Numbers inside text are compared by value, so img2.png sorts before img10.png and “Chapter 9” before “Chapter 10”.

Language-aware ordering

Uses your browser’s built-in collation rules (Intl.Collator), so accented and non-English letters land where a dictionary would put them.

Numeric sorting that reads real numbers

Finds the first number in each line, including negatives, decimals and thousands separators such as 1,200; lines without a number go last.

Stable results

Lines that compare as equal keep their original order, so sorting is predictable and repeatable.

Alphabetical vs natural vs numeric sorting

Plain alphabetical sorting compares text one character at a time, so digits are treated as characters, not numbers: “file10” comes before “file2” because “1” is smaller than “2”. That is fine for words, but wrong for numbered items. Natural sort reads each run of digits as a whole number, giving the order a person expects. Numeric value goes further and sorts by the first number in each line, wherever it appears — ideal for prices, scores or measurements.

InputAlphabeticalNaturalNumeric value
file10, file2, file1file1, file10, file2file1, file2, file10file1, file2, file10
$1,200 / 30 / -5$1,200, -5, 30$1,200, -5, 30-5, 30, $1,200
Zoe, émile, AdamAdam, émile, ZoeAdam, émile, Zoe(no numbers — original order)

Case and language options explained

  • Case-insensitive (on by default) treats “apple” and “Apple” as equal, so capitalised words are not all pushed to the top.
  • Language-aware uses Unicode collation, which puts “é” with “e” and handles letters such as “ß” and “ñ” sensibly. Untick it for strict code-point order (ASCII order), where capital letters come before lowercase and accented letters come after “z” — sometimes needed for programming or matching another system’s output.
  • Remove duplicates drops repeated lines after sorting, respecting the case option. For more control over duplicates — keeping the last copy, or seeing what was removed — use Remove Duplicate Lines.
  • Remove empty lines (on by default) stops blank lines from collecting at the top of the result.

Useful things to do with sorted lists

Number a sorted list with Add Line Numbers, flip it end to end with Reverse Text, or pick random winners with the List Randomizer. Lines copied from Windows programs use CRLF line endings; they are recognised automatically and the result uses standard line breaks that paste cleanly into Excel, Google Sheets or code.

Sort Lines FAQ

How do I sort lines alphabetically?

Paste your list, choose “Alphabetical” under “Sort by” and pick A → Z or Z → A. The sorted lines appear immediately and can be copied or downloaded as a .txt file.

Why does 10 come before 2 when I sort?

Alphabetical sorting compares characters, and “1” comes before “2”. Choose “Natural” to sort numbers inside text by their value, or “Numeric value” to sort lines by the first number they contain.

Can I sort lines by length?

Yes. Choose “Line length” and pick shortest or longest first. Length is measured in visible characters, so an emoji or an accented letter counts as one.

How do I shuffle lines randomly?

Choose “Random shuffle”. Every line is kept exactly once in a random order; press “Shuffle again” for a different order.

Does sorting keep duplicate and empty lines?

Duplicates are kept unless you tick “Remove duplicates”. Empty lines are removed by default so they do not gather at the top; untick “Remove empty lines” to keep them.

Is my list uploaded anywhere?

No. Sorting runs in your browser using JavaScript, so your list is never sent to a server.

You might also need