Skip to main content

Sort Lines

Loading…

About Sort Lines

The Sort Lines tool lets you sort lines of text instantly. Arrange entries in A–Z order, Z–A order, ascending numeric order, descending numeric order, shortest-first order, or longest-first order. It works with word lists, email addresses, URLs, code snippets, and other text data.

Simply paste your text, choose a sorting method, and get the result immediately. Whether you are organizing keywords, cleaning a list, sorting names, or arranging data for a report, this tool makes the process quick and easy.

The numeric sorting mode recognizes numbers within lines. For example, "2" appears before "10" when sorting numerically. This produces more accurate results than a standard alphabetical sort, which would place "10" before "2".

Locale-aware sorting handles accented characters like é, ñ, and ü correctly, placing them in their natural language order instead of by raw character code.

Everything runs locally in your browser. Your data is never uploaded or stored on a server. Even large lists can be sorted in seconds.

Practical Uses for Sort Lines

  • Sort a list of email addresses alphabetically before a mail merge
  • Sort product prices numerically for a pricing table
  • Alphabetize a bibliography or works-cited list
  • Sort a list of domains before a bulk WHOIS check
  • Order survey responses by length to spot outliers
  • Sort a keyword list alphabetically for a content calendar

How to Use Sort Lines

  1. Paste your list into the input — one item per line.

  2. Choose a sort mode: A→Z, Z→A, Shortest first, Longest first, or Numeric.

  3. The sorted output appears instantly.

  4. Copy the result with one click.

Examples

Example — A→Z alphabetical
Input
banana
apple
date
cherry
Output
apple
banana
cherry
date
Example — Numeric sort
Input
10
2
1
20
3
Output
1
2
3
10
20
Example — Shortest first
Input
elephant
cat
bee
dog
Output
bee
cat
dog
elephant
Example — Z→A reverse
Input
apple
banana
cherry
Output
cherry
banana
apple
Example — Sort prices numerically
Input
$19.99
$5.00
$120.00
$8.50
Output
$5.00
$8.50
$19.99
$120.00
Example — Alphabetize a bibliography
Input
Smith, J. (2020)
Adams, R. (2018)
Zhao, L. (2021)
Output
Adams, R. (2018)
Smith, J. (2020)
Zhao, L. (2021)

Who Uses the Sort Lines Tool

  • Writers and students alphabetize bibliographies, glossaries, and works-cited lists in seconds.
  • Data analysts sort numeric columns copied from a spreadsheet without opening Excel.
  • Developers sort arrays of strings or numbers before pasting them into code or a config file.
  • SEO professionals sort keyword lists alphabetically or by length when building a content plan.
  • Project managers sort task lists or ticket IDs into a consistent order for reports.

Comparisons

Alphabetical Sort vs Numeric Sort

A plain alphabetical (lexicographic) sort compares text character by character, which means “10” sorts before “2” because “1” comes before “2” as a character. That produces the wrong order for anything meant to be read as a number.

Numeric sort mode instead reads each line as a number and compares its value, so 2 correctly comes before 10. Use alphabetical sort for names, words, and general text; use numeric sort whenever your lines represent quantities, prices, or IDs.

Frequently Asked Questions

Can it sort numbers correctly?

Yes — select Numeric sort mode and lines like '2', '10', '1' sort as 1, 2, 10 (not 1, 10, 2 as alphabetical sort would produce).

Does it sort accented characters correctly?

Yes — locale-aware sorting is used, so é, ñ, ü sort naturally in their language rather than being placed at the end by raw character code.

Can I sort in reverse alphabetical order?

Yes — select Z→A mode to sort lines in reverse alphabetical order.

What does sorting by length do?

Shortest First places the shortest lines at the top. Longest First places the longest lines at the top. Lines of equal length remain in their original relative order.

Does it remove duplicates when sorting?

No — sorting preserves all lines including duplicates. Use the Remove Duplicates tool first if you want to deduplicate before sorting.

Can I sort a list of domain names or URLs?

Yes — paste your URLs or domains one per line and use A→Z sorting. They'll be sorted alphabetically, which groups similar domains together.

Is sorting stable?

Yes — lines that compare as equal (e.g. same length in length-sort mode) preserve their original relative order.

Can I sort a column of prices?

Yes — paste the prices one per line (with or without a currency symbol, as long as it's consistent) and use Numeric sort mode to order them from lowest to highest.

Can I sort by the last word on each line instead of the first?

Not directly — for that, use Find & Replace with a regex capture group to move the last word to the front, sort, then reformat. For simple alphabetical or numeric sorting, this tool handles the line as-is from the start.

Does sorting work on mixed text and numbers?

Yes — alphabetical sort treats every line as text, so mixed content sorts consistently by character. If your list is purely numeric, switch to Numeric sort mode for correct numeric ordering.