inyourbrowser.com

Sort lines

Sort lines is a text tool that reorders a list of lines using one of several modes. It supports alphabetical (ascending or descending), numeric, by length, and random shuffle, or can keep the original order, plus options to deduplicate, trim whitespace, and remove empty lines. The tool runs in your browser.

Input

Output

SORT OPTIONS

How to sort lines

  1. Paste your list into the input area, one item per line.
  2. Choose a sort mode: A to Z, Z to A, numeric, shortest first, longest first, shuffle, or keep original order.
  3. Toggle options like Remove duplicates or Trim whitespace as needed.
  4. The sorted output appears instantly. Copy it from the output area.

Common uses

  • Sorting alphabetical lists such as names, keywords, or file names in one click
  • Removing duplicate entries from a list before importing into a spreadsheet or database
  • Working alongside find and replace and word counter for complete text workflows

Technical specification

  • Algorithm or formula: Alphabetic sort uses Array.prototype.sort with a locale-aware comparator (Intl.Collator). Numeric sort orders lines by the number they start with. Length-based sort counts characters with Intl.Segmenter, so an emoji counts as one. Shuffle mode uses the Fisher-Yates algorithm with Math.random().
  • Browser API or library: Native Array.prototype.sort, Intl.Collator and Intl.Segmenter; no external library.
  • Input limits: No hard cap; tested with lists of 100,000 lines on modern hardware.
  • Output: Sorted text in the output pane, copyable to clipboard, with a count summary of original and resulting line counts.
  • Known limitations: Alphabetical comparison is case-insensitive by default and follows the browser's locale. Numeric sort understands a minus sign and a decimal point, but not thousands separators such as 1,000. Math.random() is not cryptographically secure but is sufficient for visual shuffling.

Frequently asked questions

What sort modes are available?
Seven modes: Keep original order (no sorting), A to Z (alphabetical ascending), Z to A (alphabetical descending), Numeric (by the number each line starts with), Shortest first (by character count), Longest first (by character count), and Shuffle (random order using Fisher-Yates).
How does duplicate removal work?
Duplicate removal keeps the first occurrence of each unique line and discards the rest. Comparison is case-insensitive and respects any whitespace trimming you have enabled.
Can I shuffle my list randomly?
Yes. The Shuffle mode uses the Fisher-Yates algorithm with Math.random() to produce a randomly ordered list. Click Shuffle again for a new random order.
Is my text sent to a server?
All text processing runs locally in your browser. Our servers are not involved at any point.

Related tools

Find & replace
Find and replace text with plain search or regular expressions. Supports case-sensitive and whole-word matching.
Text diff
Compare two texts in word, side-by-side, or git-style views. The word and side-by-side views highlight changed words.
Case converter
Convert text between camelCase, snake_case, kebab-case, PascalCase and more.
CSV ↔ JSON
Convert CSV to JSON and JSON back to CSV. Handles quoted fields and downloads.

Reviewed and tested September 30, 2026.