PRPickrack

Sort Lines

Sort text lines alphabetically, numerically, by length, naturally, or shuffle. Optional dedup + blank-line filter.

Sort lines alphabetically, numerically, by length, naturally, or shuffle. Optional dedup + blank filter.

Sort Lines rearranges the lines of any text in one of 9 ways: alphabetical (A→Z, Z→A), natural (file1, file2, file10 — not file1, file10, file2), numerical (parses each line as a number), by length (short→long or reverse), reverse (flip order without sorting), or shuffle (random order). Add dedup and blank-line filtering for cleaner output in one pass.

Use it for: cleaning up CSV columns, organizing import lists, ordering checklist items, randomizing test inputs, sorting log entries, alphabetizing tag lists, or just making a text list look tidy.

Free, no signup, browser-side. Sort uses JavaScript's localeCompare for proper Unicode-aware alphabetization (handles diacritics, mixed scripts correctly).

Key features

  • 9 sort modesA→Z, Z→A, natural (numeric-aware), numeric asc/desc, by length asc/desc, reverse, shuffle.
  • Natural sortfile1, file2, file10 instead of file1, file10, file2. The right way to sort filenames or chapter numbers.
  • Dedup optionRemove duplicate lines as part of the sort (uses case-insensitive matching when that flag is on).
  • Drop blank linesFilter out empty lines before sorting. Often what you want.
  • Case-insensitive defaultApple and apple group together. Toggle off for strict case sort.
  • Live countInput → output line count + how many were removed (by dedup or blank filter).

How to use

  1. Step 1: Paste linesOne item per line — names, URLs, filenames, dates, numbers.
  2. Step 2: Pick a sort mode9 options. A→Z covers most cases. Natural for filenames. Numeric for numbers. By length for visual hierarchy.
  3. Step 3 (optional): Toggle flagsCase-insensitive (usually yes), Dedup, Drop blanks.
  4. Step 4: CopyOutput updates live. Click Copy or 'Swap in' to chain another operation.

When to use

  • Alphabetize a tag list#javascript, #python, #go → sorted
  • Sort filenames naturallychapter1.md, chapter2.md, chapter10.md (in this order, not 1, 10, 2)
  • Order email addresses by domain length
  • Randomize a test order — shuffle a class roster for fairness
  • Reverse a chronological log — newest-first
  • Sort + dedup combo — clean up a list of imported entries in one click
  • Sort numeric values from CSV — order line items by price

Frequently asked questions

What's the difference between alphabetical and natural sort?

Alphabetical (A→Z) compares character-by-character: file10 comes before file2 because '1' < '2'. Natural sort recognizes runs of digits and sorts them as numbers: file2 before file10. Use natural for anything with embedded numbers (filenames, version strings, chapter numbers). Use alphabetical for pure-text data.

How does shuffle work?

Uses Fisher-Yates shuffle with Math.random(). Not cryptographically secure but uniform enough for typical use cases (testing, random ordering for fairness).

What if my numeric mode encounters non-numbers?

Lines that can't be parsed as numbers are treated as 0 (so they cluster at the start in ascending order). For mixed numeric/text data, use Natural sort instead.

Why does case-insensitive sort change capitalization?

It doesn't — case-insensitive sort orders items as if they're all lowercase, but preserves the original case in output. E.g., Apple and apple group together but each keeps its case.

How is sort stable?

JavaScript's Array.sort() is stable (since ES2019). Items that compare equal preserve their original order. Important when sorting by a single column from CSV-like data.

Can I sort by a specific column / field?

Not in v1 — input must be one item per line. For CSV column sort, extract the column first with another tool (or use Excel/Sheets). Field-based sort is on the roadmap.

Max number of lines?

Tested to 100,000 lines. Above that the textarea becomes slow but the sort itself still works.

Related tools