Sort Lines Alphabetically (Or by Length, Number)

Sort any text block by lines — alphabetical (case-sensitive or not), length, numerically (for lists of numbers), or reverse. Optional deduplication. Useful for cleaning todo lists, sorting CSV columns, organizing imports.

How to use the Sort Lines Alphabetically (Or by Length, Number)

Paste lines and choose a sort mode — alphabetical, by length, numeric, or natural (so 2 comes before 10). Optionally reverse the order, make it case-sensitive, or deduplicate as you sort. Copy the result.

Sorting lines the way you actually need

A plain alphabetical sort is rarely all you want. Numbers sort wrong lexically — 10 lands before 2 — filenames with digits need “natural” order to read sensibly, and sometimes it is length or reverse order that matters. Doing these in an editor is awkward and inconsistent.

This sorts a block of lines four ways — alphabetical, by length, numeric, or natural — with reverse, case-sensitivity, and dedupe as independent options. To remove duplicates without reordering, see deduplicate lines; to compare two lists for shared and unique entries, compare two lists.

Common use cases

  • Tidying lists — alphabetize a todo list, an import block, or a word list.
  • Numeric sorting — order a column of numbers by value rather than by digit.
  • Natural order — sort file-1, file-2, file-10 the way a person expects.
  • Longest first — surface the longest lines by sorting on length and reversing.
  • Dedupe-and-sort — clean and order a messy list in a single step.

Frequently asked questions

What is “natural” sort?

It treats embedded numbers as numbers, so file2 comes before file10 instead of after it.

Why use numeric instead of alphabetical for numbers?

Alphabetical compares character by character, which puts 10 before 2. Numeric compares by value, which is usually what you want.

Can it sort and deduplicate at once?

Yes — enable the dedupe option to drop repeated lines as part of the sort.

Is the sort case-sensitive?

By default no, so Apple and apple sort together. Enable case-sensitive to separate upper- and lower-case.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: