Skip to main content
TOP free online tools Your Workbench
English

Sort Lines

Sort lines of text alphabetically or numerically in your browser. Free, online, no upload, fully private.

Local browser processing — zero server uploads

How to Use

  1. Paste or type your text into the Sort Lines input area above.
  2. Configure any format or mode options to generate the sorted text in real time.
  3. Click Copy to copy the formatted result to your clipboard, or Reset to clear the workbench.

What is Sort Lines?

Sort Lines arranges multi-line text lists in ascending or descending order using either alphabetical (locale-aware) or numerical comparison. Programmers, analysts, and editors use it to organize imports, rank numeric lists, alphabetize glossaries, and normalize diffs instantly.

How It Works

Every input edit or dropdown change splits the textarea on `/\r?\n/` and runs `Array.prototype.sort()` inside your browser. In Alphabetical mode it compares lines with `String.prototype.localeCompare()`; in Numerical mode it compares `Number(a) - Number(b)` and seamlessly falls back to `localeCompare` if any line is non-numeric.

Common Use Cases

  • Alphabetizing bibliographies and lists — sort glossary entries, names, or tags A–Z or Z–A in real time
  • Ranking numeric exports — sort scores, prices, or IDs numerically so `10` correctly comes after `2` instead of before
  • Normalizing config or dependency files — sort lines before comparing two environment or ignore files in a diff tool
  • Top-to-bottom reverse ordering — toggle Order to Descending to flip alphabetical or numeric lists immediately
Technical Details

Execution: real-time browser `Array.prototype.sort` on `/\r?\n/` lines. Supports `alpha` (`localeCompare`) and `numeric` (`Number(a) - Number(b)` with `localeCompare` NaN fallback) across `asc` / `desc` order.

FAQ

Is my text uploaded?

No. Sorting happens locally in your browser. Your text never leaves your device.

Can I sort in reverse order?

Yes. You can choose ascending or descending order, and sort alphabetically or numerically.