OhMyApps
Back to Blog
Tools Text Sort Lines Tutorial

Line Sorter: Sort Text Lines Alphabetically or Numerically

2 min read By OhMyApps

Sorting lines of text is a common task when working with lists, data files, log entries, or any line-based content. Our line sorter handles alphabetical and numeric sorting with options for case sensitivity, duplicate removal, and whitespace cleanup.

Sorting Modes

Alphabetical Sort (Default)

Sorts lines using standard string comparison. Uppercase letters sort before lowercase in default mode:

banana → apple
apple  → banana
cherry → cherry

Numeric Sort

Sorts by the numeric value at the start of each line:

10 items  → 2 items
2 items   → 10 items
100 items → 100 items

Without numeric sort, “10” would come before “2” because “1” < “2” in string comparison.

Case-Insensitive Sort

Treats uppercase and lowercase as equivalent:

banana → Apple
Apple  → banana
cherry → cherry

Options

  • A → Z / Z → A — ascending or descending order
  • Numeric sort — sort by number value instead of string
  • Case insensitive — ignore capitalization
  • Remove duplicates — keep only unique lines
  • Trim whitespace — strip leading/trailing spaces
  • Skip empty lines — remove blank lines from the result

How to Use Our Line Sorter

  1. Paste your lines in the input area (one item per line)
  2. Choose ascending (A → Z) or descending (Z → A)
  3. Enable any options you need (numeric, case-insensitive, etc.)
  4. View the sorted result instantly
  5. Copy the sorted output

Common Use Cases

  • Sorting lists — alphabetize any list (names, words, items)
  • Cleaning data — sort and deduplicate CSV columns or lists
  • Organizing imports — sort import statements in code
  • Log analysis — sort log entries for easier scanning
  • Requirements — alphabetize dependency lists

Try our free Line Sorter to sort text lines instantly.

Try Ghost Image Hub

The Chrome extension that makes managing your Ghost blog images a breeze.

Learn More