Text & Writing

Line Sorter

Put a pasted list in a useful order. Natural sorting handles numbered names such as Chapter 2 and Chapter 10; numeric sorting compares complete decimal values; length sorting groups short and long entries. Optional trimming and blank-line removal are explicit choices.

Free online tool

Loading tool…

0 output lines. Equal sort keys retain their input order.

Maximum 100,000 UTF-16 code units and 10,000 lines. Text sorting uses English collation; ordering may vary slightly with browser locale data. Numeric mode accepts signed decimals and scientific notation, with JavaScript floating-point precision. Processing stays in this browser; text is not submitted to a server.

Text is processed locally in your browser. No tool input is sent to a remote processing service.

GET STARTED

How to use the Line Sorter

  1. 01

    Paste one value, name, or record per line.

  2. 02

    Choose English alphabetical, natural, numeric, or length sorting.

  3. 03

    Select ascending or descending and decide whether to trim or remove blank lines.

  4. 04

    Review the output, then copy it or download a plain-text list.

Examples

Numbered chapter labels

Natural ascending order places Chapter 1, Chapter 2, and Chapter 10 in that order. Alphabetical sorting usually places Chapter 10 before Chapter 2 because the digits are treated as text.

Signed numeric values

Numeric mode orders -10, 0.5, 2, and 1e2 by value. Currency symbols, thousands separators, and labels such as “2 kg” are rejected instead of being partially parsed.

Stable equal values

The numeric lines 2, 2.0, and 02 compare as equal. They stay in their input order in both directions. Sort mode never silently removes repeated entries.

Natural order and numeric order solve different problems

Natural mode is for mixed text containing digit runs: file2 can precede file10 while the surrounding letters still participate in English collation. It is not a full number parser; signs, decimal points, dates, and version components do not automatically receive mathematical meaning. Choose numeric mode when the whole line is a number. Numeric mode accepts signed decimals and scientific notation and rejects infinity, hexadecimal syntax, blank values, and partially numeric records.

English text comparison and stable ties

Alphabetical and natural modes use English collation. Ignore case combines upper- and lowercase sort keys while retaining accent distinctions. Exact ordering of punctuation and some scripts can vary with the browser’s collation data. Every comparison uses the original line position as a tie breaker. Descending reverses the meaningful sort direction without reversing equal-key entries. This keeps equivalent numeric forms or case variants in a predictable order.

Length is measured in code points

Length mode counts Unicode code points, not UTF-16 code units, bytes, visible grapheme clusters, or display columns. A basic supplementary-plane emoji counts as one code point, while a joined family emoji contains several. Use this mode to group entries by encoded character content, rather than to enforce a visual width. If you need hard line wrapping that keeps emoji sequences together, use the Word Wrap Tool instead.

Preserve or clean the list explicitly

Sorting preserves line contents unless Trim line edges is selected. Removing blank lines treats whitespace-only lines as blank. Otherwise they remain records in the sorted output, including a final empty line from a trailing newline. CRLF and CR line endings become LF. The maximum is 100,000 UTF-16 code units and 10,000 lines. Numeric comparison uses JavaScript numbers, so very large integers and very close decimal values can compare equal after floating-point rounding.

What to know

  • Maximum 100,000 UTF-16 code units and 10,000 lines.
  • English collation is browser dependent; numeric precision follows JavaScript floating-point numbers.

Common questions

Does this sort CSV rows by a selected column?

No. Each full line is one record. Quoted multiline CSV and field-aware sorting need a spreadsheet or CSV-specific tool.

Will version 1.10 always follow version 1.9?

Natural mode often gives useful ordering for digit runs, but it is not a Semantic Versioning parser and does not interpret prerelease or build metadata.

Why does numeric mode reject an empty line?

An empty line is not treated as zero. Enable Remove blank lines or remove the empty record before numeric sorting.

Sources & references