HCODX/Sort Lines
100% browser-based · Natural / alpha / numeric · Asc / desc

Sort Lines

Sort lines alphabetically (default), naturally (10 after 2), or numerically. Toggle case-sensitivity and direction.

Plain text
Sorted lines
Sort options
Deduplicate Lines
Input lines
0
Output lines
0
Mode
Status
Ready
Example

Unsorted in, sorted out

Natural mode treats embedded numbers as numbers — so item 2 comes before item 10, not after it.

Input
banana
apple
Cherry
item 10
item 2
fig
elderberry
Sorted (natural, asc)
apple
banana
Cherry
elderberry
fig
item 2
item 10
Use cases

What you'll use this for

Lists, logs, exports — anywhere data lands unsorted and you need to bring order quickly.

CSV column sort

Paste a single CSV column and sort alphabetically before re-merging into the spreadsheet.

Log timestamp sort

Reorder log lines chronologically when concatenating across files. Natural mode keeps numbers sane.

Todo lists

Group tasks alphabetically or by length to spot the quickest wins first.

Names alphabetization

Sort attendee lists, contact exports, or any name column before sharing.

Step by step

How to sort lines

1

Paste your text

Drop the list, log, or column into the left editor. One value per line.

2

Pick mode and direction

Alphabetical works for plain strings. Natural is best for mixed letter/number text. Numeric for pure numbers.

3

Click Sort

Or leave auto-sort on for live updates. Runs locally — no upload.

4

Copy or download

Copy to clipboard or save as sorted.txt. Pair with deduplicate-lines for a clean unique set.

FAQ

Frequently asked questions

Alphabetical sort compares character by character so item 10 sorts before item 2 (because 1 < 2). Natural sort recognises embedded numbers and orders them numerically, producing item 2, item 10.

Yes. The tool uses the browser Intl.Collator API, which respects locale rules for accented characters (e.g. é sorts near e) and case folding.

Yes. No signup, no limits, no ads. Runs entirely in your browser.

Yes. Array.prototype.sort in modern browsers is stable, so equal lines preserve their input order. This matters when you sort by length, for example.

Not in one step. If you need to sort CSV rows by a specific column, pre-process the data so that the key column is at the start of each line, sort, then restore the original layout.

About

About sorting lines

Sorting puts a list of lines into a predictable order so it's easier to scan, diff, and deduplicate. This tool implements three comparison strategies plus a length-based sort, all powered by the browser's native APIs.

How sorting works

  • Alphabetical uses Intl.Collator with locale rules, so accented characters and case fold naturally.
  • Natural turns on the numeric flag, treating digit runs as numbers (file2 before file10).
  • Numeric parses each line as a float and sorts on that value — best for pure number columns.
  • By length sorts by character count, useful for spotting outlier rows.

When to use which mode

  • Alphabetical — names, words, plain strings.
  • Natural — filenames, version numbers, anything mixing letters and numbers.
  • Numeric — pure numeric data (prices, IDs).
Related

Related tools