Alphabetize List & Sort Lines Online

Sort lists, names, keywords, and text lines alphabetically in ascending (A–Z) or descending (Z–A) order.

Alphabetize List sorts multiline text in ascending (A–Z) or descending (Z–A) order using natural numeric collation (localeCompare with numeric: true). For example, Zebra\nItem 10\nItem 2\nApple (4 lines, 25 chars) becomes Apple\nItem 2\nItem 10\nZebra (4 lines, 25 chars).

Fixed:
0 Characters
0 Words
0 Sentences
🧹 Remove
🔤 Convert
📑 Format
Copied to clipboard

How Does the Online List Alphabetizer Work?

The alphabetizer splits text on newline boundaries (\n) and orders lines using Unicode-aware natural collation so multi-digit numbers sort by value (Item 2 before Item 10) rather than ASCII code point.

Text Cleaner uses natural locale-aware sorting rules (localeCompare with numeric collation). Numbers inside items (such as Item 2 and Item 10) are ordered logically rather than strictly as raw characters.

What Algorithm & Collation Rule Does Sorting Use?

Line sorting executes lines.sort((a, b) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" })) for A–Z order, and reverses the comparator for Z–A order.

  • Line Tokenization Rule: Split input on \n (U+000A), sort array in memory, and rejoin with \n.
  • Case-Insensitive Base Sensitivity: apple and Apple compare by base character rather than separating uppercase and lowercase ASCII blocks.
  • Worked Before / After Example: Input Zebra\nApple\nMango\nBanana\nOrange (5 lines, 5 words, 31 characters) → Output Apple\nBanana\nMango\nOrange\nZebra (5 lines, 5 words, 31 characters, 4 line positions reordered).
Sorting Mode / Algorithm Rule Input Example (Before) Output Result (After) Lines Reordered (count)
Sort A–Z (localeCompare ascending) Zebra\nApple\nMango (3 lines, 17 chars) Apple\nMango\nZebra (3 lines, 17 chars) 3 lines reordered (0 chars lost)
Sort Z–A (localeCompare descending) Apple\nMango\nZebra (3 lines, 17 chars) Zebra\nMango\nApple (3 lines, 17 chars) 2 lines swapped (0 chars lost)
Natural Numeric Collation (numeric: true) Chapter 10\nChapter 2\nChapter 1 (3 lines, 30 chars) Chapter 1\nChapter 2\nChapter 10 (3 lines, 30 chars) 3 lines ordered numerically
Deduplicate + Sort A–Z Pipeline Banana\nApple\nBanana (3 lines, 19 chars) Apple\nBanana (2 lines, 12 chars) 1 duplicate line removed (-7 chars)

How Can You Combine Sorting with Deduplication?

Click Dedupe first to strip repeated lines in O(n) time, then click Sort A–Z to produce a unique, alphabetically ordered list.

Need a clean, unique sorted list? Click Dedupe to eliminate repeat entries, then click Sort A–Z for a clean alphabetized result.

How to use this tool:

  1. Paste or type your text into the editor box above.
  2. Click the highlighted action button to run the transformation instantly on your device.
  3. Click Copy to place the cleaned text onto your clipboard.

More Free Online Text Tools

Cleaning & Stripping
Clean Pasted Text Remove Em Dash Remove Line Breaks Remove Invisible Chars Straighten Quotes Strip HTML Strip Markdown
Case Converters
All 11 Case Converters Sentence Case camelCase Converter snake_case Converter
Formatting & Analytics
Remove Duplicate Lines Alphabetize List Word & Character Counter

Clean text from any app with the Share Sheet.

Select text in Safari, Mail, or Notes and share it to Clean Text. The cleaned version is copied back to your clipboard with a summary of what was fixed.

  • Works inside Safari, Mail, Notes, Word, and Slack
  • Counts and audits damage: '2 em dashes, 3 invisible characters removed'
  • 100% on-device: zero network requests, zero telemetry, full privacy
  • Available on iPhone, iPad, and Mac
Text Cleaner: Case Converter App Screenshot