Sort Lines

Sort text lines alphabetically, numerically, by length, or in random order. Supports case-insensitive and reverse sorting.

Input
Sort Options

Frequently Asked Questions

Numerical sort uses parseFloat() on each line to extract the number and sorts by that value. Lines that don't contain a leading number are treated as 0. This correctly sorts 2, 10, 20 (unlike alphabetical, which would give 10, 2, 20).

Yes. Modern JavaScript's Array.prototype.sort() is guaranteed to be stable in all current browsers (V8, SpiderMonkey, JavaScriptCore). Lines with equal sort keys retain their original relative order.

The shuffle uses a Fisher-Yates algorithm with Math.random() for each swap. While sufficient for most use cases, it is not cryptographically secure β€” don't use it for security-critical applications. Use the Random String Generator for cryptographic randomness.

How It Works

Paste Your List

Paste any newline-separated list into the input area. Each line is treated as a sortable item.

Choose Sort Method

Select from alphabetical, reverse alphabetical, numerical, by line length, or shuffle. Set case sensitivity and trimming options.

Copy the Result

Click Sort to apply the chosen method. The sorted output appears instantly and can be copied to the clipboard.

Common Use Cases

Alphabetize Lists

Sort bibliographies, reference lists, glossary entries, or ingredient lists alphabetically for consistent, professional formatting.

Sort Numeric Data

Sort version numbers, IDs, prices, or quantities from exported reports numerically β€” without needing a spreadsheet.

CSS Property Ordering

Alphabetically sort CSS properties within a selector to enforce consistent style ordering as required by some team style guides.

Randomize Survey Options

Shuffle answer choices for surveys or quizzes to reduce order bias before pasting into your form builder.

De-duplicate & Sort Together

Enable "Remove blank lines" to clean a list while sorting, combining two operations in a single run.

Sort by Line Length

Sort lines by character length to find the shortest or longest entries in a dataset β€” useful for truncating labels or finding outliers.