📝 Sort Lines

📝
Each line will be sorted according to your selected criteria
🎯
📊
⚙️
⚡
📤
{{ result }}
📊
Original:
Lines: {{ stats.original.lines }}
Empty: {{ stats.original.emptyLines }}
Characters: {{ stats.original.characters }}
Words: {{ stats.original.words }}
Result:
Lines: {{ stats.result.lines }}
Empty: {{ stats.result.emptyLines }}
Characters: {{ stats.result.characters }}
Words: {{ stats.result.words }}
🏷️
Type: {{ getSortTypeLabel() }}
Order: {{ sortOrder ==='asc' ?'Ascending' :'Descending' }}
Case Sensitive: {{ caseSensitive ?'Yes' :'No' }}
Remove Empty: {{ removeEmpty ?'Yes' :'No' }}
Remove Duplicates: {{ removeDuplicates ?'Yes' :'No' }}
💡

Enter text lines in the input area to see them sorted according to your selected criteria.

⚠️ {{ error }}
🔄 Sorting lines...

ℹ️ About Sort Lines Tool

Sort Lines Tool rearranges one line per record so you can alphabetize lists, order numeric values, sort by line length, sort date-like entries, reverse a file, or randomize rows before copying the cleaned result. It is useful for quick text cleanup, log triage, word lists, CSV-like snippets, configuration values, and deduplicating pasted data before another tool consumes it.

Common line sorting workflows:

  • Sort names, hostnames, filenames, package names, tags, keywords, or allowlist entries from A to Z or Z to A.
  • Clean copied data by removing blank lines and duplicate lines before importing it into a spreadsheet, script, or ticket.
  • Order standalone numbers such as IDs, ports, counts, versions, or scores without the common text-sort problem where 10 appears before 2.
  • Sort by length to find the shortest or longest lines in password lists, test cases, log messages, slugs, or content snippets.
  • Reverse line order for changelogs, queue exports, command output, or any list captured newest-first or oldest-first.

Examples:

  • Alphabetical input zebra, Alpha, beta becomes Alpha, beta, zebra when case-insensitive ascending sort is selected.
  • Numeric input 10, 2, 100 should be sorted by value as 2, 10, 100.
  • Date input such as 2026-05-26, 2024-01-01, and 2025-12-31 is intended for chronological sorting when the dates are written in a parseable format.

Sort modes and cleanup options:

  • Alphabetical: A-Z or Z-A line sorting, with an optional case-sensitive comparison for exact uppercase/lowercase ordering.
  • Numerical: Compares standalone numeric lines by value instead of plain text order.
  • Length: Sorts by byte length, which is handy for finding unusually short or long records.
  • Date: Sorts lines whose trimmed value can be parsed as a date; ISO-style dates are the safest input.
  • Random and reverse: Shuffle lines for sampling or invert the current order without changing the line text.
  • Filters: Remove empty lines and remove duplicate lines before sorting, with duplicate matching affected by the case-sensitive option.

Standards and behavior notes: Browser sorting is based on JavaScript arrays and string comparison behavior defined by ECMAScript Array.prototype.sort. Case-insensitive alphabetic sorting uses locale-aware comparison concepts related to ECMA-402 collation and the Unicode Collation Algorithm. For date sorting, prefer unambiguous ISO/RFC-style timestamps such as 2026-05-26 or 2026-05-26T13:45:00Z; web timestamp conventions are documented in RFC 3339.

Limitations: This tool sorts complete lines, not CSV columns or fields inside each line. Locale-specific collation can differ between environments for accented characters, punctuation, and mixed scripts. Numeric sorting works best when each line is a single number, and date sorting depends on the browser/runtime parser, so ambiguous formats like 05/06/2026 can be interpreted differently. The input stays in your browser for interactive sorting unless you explicitly use the API endpoint.

API Usage Example:

POST /api/tools/text/sort-lines
Content-Type: application/json

{
    "text": "Charlie\nAlice\nBob\nDavid",
    "sortType": "alphabetical",
    "sortOrder": "asc",
    "caseSensitive": false,
    "removeEmpty": true,
    "removeDuplicates": false
}
Ready