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), by length, and random shuffle, plus options to deduplicate, trim whitespace, and remove empty lines. The tool runs in your browser.

Input

Sorted 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, shortest first, longest first, or shuffle.
  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 and length-based sort use Array.prototype.sort with a locale-aware comparator (Intl.Collator). Shuffle mode uses the Fisher-Yates algorithm with Math.random().
  • Browser API or library: Native Array.prototype.sort and Intl.Collator; 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. Math.random() is not cryptographically secure but is sufficient for visual shuffling.

Frequently asked questions

What sort modes are available?
Five modes: A to Z (alphabetical ascending), Z to A (alphabetical descending), 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. Each shuffle produces a different order.
Is my text sent to a server?
All text processing runs locally in your browser. No data is sent to our servers.

Reviewed and tested May 26, 2026.