Skip to content
1123.net
EN
1123.net

Search tools

Filter the tool directory. Everything runs in your browser.

Type to filter tools. Press Enter to open the first result.

Sort Text Lines

This tool sorts a list of lines without uploading it anywhere. It can order text alphabetically or by the first number on each line, in either direction, and preserves the full line content.

Your data is processed locally in your browser and is not uploaded to our server.

Options
0 lines in 0 lines out

How to use this tool

  1. 1 Paste the list into the input box, one item per line.
  2. 2 Choose ascending or descending, and switch on numeric sorting if the lines start with numbers.
  3. 3 Adjust case sensitivity, trimming and empty-line handling to match your data.
  4. 4 Copy the sorted list, or clear the box to start a new one.

Formula and calculation logic

Alphabetical sorting

Compare lines with the locale-aware collator

Sorting uses the browser’s collation rules for the page language. With “ignore case” on, “apple” and “Apple” compare as equal, and the original order decides the tie.

Numeric sorting

Key = first number found in the line

Numeric mode compares the first number on each line, including negatives and decimals. Lines without a number are placed after numbered lines and then sorted alphabetically.

Worked example

Sorting names

A list of names is in the order it was typed.

  1. Input: Zoe, adam, Mia
  2. Ascending, ignore case
  3. Output: adam, Mia, Zoe

Case-insensitive alphabetical order puts adam first even though the input started with Zoe.

Sorting quantities

A shopping list starts with numbers.

  1. Input: 10 apples, 2 pears, 1 lemon
  2. Numeric ascending
  3. Output: 1 lemon, 2 pears, 10 apples

Numeric mode compares 1, 2 and 10 as numbers, not as text, so 10 does not come before 2.

Edge cases and accuracy

Numbers inside text

Numeric mode reads the first number it finds. A line such as “version 2 beta” is compared by 2, which may not be what you want for mixed content.

Empty lines

Empty lines can be kept in place or removed before sorting. Removing them first avoids blank entries at the top of the output.

Stable order for ties

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

Frequently asked questions

Does it sort the whole line or just the first word? +

It always keeps the whole line. Sorting compares the complete line, or the first number when numeric mode is enabled.

Why does “10” come before “2” in alphabetical mode? +

Alphabetical sorting compares characters, and “1” comes before “2”. Switch on numeric sorting to compare the values 10 and 2 instead.

Is the sort case-sensitive by default? +

No. “Ignore case” is on by default, so “apple” and “Apple” are treated as equal; their original order decides which comes first.

Can I sort in descending order? +

Yes. Choose “Descending” and the same comparison is applied in reverse. Ties still keep their original order.

Is my list uploaded? +

No. Sorting happens entirely in your browser and the text is never sent to a server.