Opening in-site article…

Text Sort: Sort Lines in Ascending or Descending Order — Tutorial

Sort multi-line text by line, supporting both ascending (A-Z) and descending (Z-A) order. All processing is local in your browser — no server upload.

Text Sort Tool - Blank Interface

Features

  • Paste multi-line text.
  • One-click ascending or descending sort.
  • Choose whether to ignore or respect leading/trailing spaces.
  • Quick result copy supported.

Use Cases

  • List organization: Sort names, emails, phone numbers alphabetically or numerically for easier management.
  • Data sorting: Sort extracted keywords, tags, or IDs to improve readability.
  • Log analysis: Sort log entries by time or keyword for easier searching and analysis.

How to Use

  1. Paste text (one item per line) in the input box above.
  2. Choose space handling: default “Ignored leading/trailing spaces”, or “Respect leading/trailing spaces”.
  3. Click "Ascending" or "Descending" to sort.
  4. Ascending: Arrange from small to large by locale natural order (case-insensitive for letters; numeric comparison for digits).
  5. Descending: Arrange from large to small by locale natural order.
  6. Sorting results display in the output box below and auto-copy to clipboard.

Notes

  • Sorting rule: Intl.Collator('zh-Hans-CN', { numeric: true, sensitivity: 'base' }); case-insensitive for English letters, numeric comparison for digit segments (e.g., 2 comes before 10).
  • Leading/trailing spaces: ignored by default (trim); in respect mode, spaces participate in comparison and remain in the result. Empty lines after trim are dropped in ignore mode; only fully empty lines are dropped in respect mode.
  • No duplicate removal: This tool only adjusts line order; use the "Text Deduplicate" tool to remove duplicates.

Related Keywords

Text Sort, Online Text Sort, textsort, leading trailing spaces, Sanye Hub, Online Tools, 10000