Sort Lines

Sort lines alphabetically, numerically, ascending or descending. Options for case sensitivity and blank line removal.

Last updated: June 1, 2026

What is Sort Lines?

A line sorter arranges lines of text in alphabetical, reverse alphabetical, numerical, or custom order. It handles common sorting needs that are cumbersome in text editors — sorting imports in code files, organizing lists, alphabetizing names, ordering data by numeric value, and removing duplicates while sorting. It supports case-sensitive and case-insensitive sorting, natural number ordering (so 'item2' comes before 'item10'), and reverse sort.

How It Works

The tool splits your input text on newline characters into individual lines, then applies the selected sorting algorithm. Alphabetical sort uses locale-aware string comparison for correct ordering of accented and international characters. Natural sort treats embedded numbers as numeric values rather than character sequences. Numeric sort extracts the first number from each line and sorts by that value. You can optionally remove duplicates, trim whitespace, and remove empty lines during the sort operation.

Common Use Cases

  • Alphabetizing import statements in JavaScript, Python, or Java source files
  • Sorting name lists, glossary terms, or index entries for publications
  • Ordering CSV data by a column value when you can't open it in a spreadsheet
  • Sorting server log entries, error messages, or event lists by timestamp
  • Organizing configuration file entries (environment variables, settings) alphabetically
  • Cleaning up and ordering TODO lists, bookmarks, or link collections

Frequently Asked Questions

Can I sort numbers correctly?

Yes, enable 'Numeric sort' to sort by numerical value instead of alphabetically.

Learn More

Dive deeper with our guides related to Sort Lines:

Related Tools

If you find Sort Lines useful, you might also want to try these related tools from our Text Tools collection: