Sort Lines - Sort Text Lines Alphabetically or by Length

Order lists alphabetically, sort numbers properly from lowest to highest, rank strings by character length, or shuffle lines into a randomized sequence—all privately in your browser.

Sort Lines

How to use this tool

  1. 1Paste your list of items, keywords, or numbers into the Input Lines box with one entry on each line.
  2. 2Select one of the seven mode buttons above the editor: A to Z, Z to A, Numeric (Low–High), Numeric (High–Low), Shortest First, Longest First, or Random Shuffle.
  3. 3Toggle the Case-insensitive, Remove empty lines, or Remove duplicates checkboxes depending on how clean you want the final sorted list.
  4. 4Inspect the ordered list and line count in Sorted Output, then click Copy to copy the results or Clear to reset.

What this tool does

Sort Lines reorders multi-line text directly inside your browser using seven distinct sorting modes and optional pre-sort cleanup filters without sending data to any server:

  • Alphabetical sorting (A to Z and Z to A) orders rows using locale-aware comparison, and the Case-insensitive checkbox lets you ignore capital-letter differences while ordering or deduplicating.
  • Numeric (Low–High) and Numeric (High–Low) extract leading numbers—including negative values and decimals—so numbers like 2, 10, and 100 sort mathematically, while any non-numeric text lines fall cleanly to the end.
  • Shortest First and Longest First compare the character length of each line from shortest to longest or longest to shortest, breaking equal-length ties alphabetically.
  • Random Shuffle applies Fisher-Yates shuffling using browser Web Crypto randomness, and clicking Random Shuffle again draws a fresh random sequence.
  • Optional Remove empty lines and Remove duplicates checkboxes strip blank rows and repeated entries before sorting begins.

Example

Sample input (Numeric Low to High, Remove duplicates on)
100
2.5
20
2.5
-4
Sorted output
-4
2.5
20
100

(Sorted Output: 4 lines)

Duplicate 2.5 is filtered out before sorting, and numeric ordering places -4, 2.5, 20, and 100 in true mathematical sequence instead of treating 100 as coming before 20.

Frequently asked questions

How does numeric sort differ from alphabetical sort?

Alphabetical sort compares characters from left to right, so "10" comes before "2" because "1" precedes "2". Numeric sort converts the number on each line into a real numeric value so 2 comes before 10.

Can Sort Lines handle numbers with decimals?

Yes. Numeric Ascending and Numeric Descending parse full floating-point numbers, including decimals like 3.14 and negative values such as -5.5.

Does sorting change the content inside each line?

No. Sorting only reorders lines unless you turn on Remove empty lines or Remove duplicates to drop extra rows.

How is Random Shuffle generated?

Random Shuffle uses the browser Web Crypto API (crypto.getRandomValues) with Fisher-Yates shuffling to randomize line order locally without predictable seeds.

Related tools

View All Tools