行排序
输入行
排序后的行
0 行

Sort Lines Online - Free Alphabetical & Numeric Line Sorter

The Delimiter.site Sort Lines tool reorders any list of text lines in six different ways - alphabetically, reverse-alphabetically, numerically, reverse-numerically, in reverse order, or randomly shuffled - all in real time with a single click. No spreadsheet, no script, no setup required.

Paste one item per line and pick a mode. If your list is currently a comma-separated or tab-separated string rather than one item per line, run it through the delimiter converter first to split it into lines, then sort lines here and join it back into whatever format you need.

Quick answer: paste one item per line, pick a mode, copy the result. Use A → Z for words and 1 → 9 for numbers — sorting numbers alphabetically puts 100 before 2.

The Six Sort Modes Explained

A → Z (Alphabetical Ascending)

Sorts lines in standard dictionary order from A to Z. Uses locale-aware comparison (localeCompare) so accented characters sort in the correct position relative to their base letter. This is the most common sort for names, keywords, and labels.

Z → A (Alphabetical Descending)

The reverse of A → Z. Sorts lines from Z to A. Useful when you need to present items in reverse alphabetical order, or to quickly identify the last entries in a dataset.

1 → 9 (Numeric Ascending)

Treats each line as a number and sorts from smallest to largest. Lines that are not numeric are placed at the end. The sort uses parseFloat, so it handles integers, decimals, and negative numbers correctly - unlike a plain text sort where 10 would sort before 9.

9 → 1 (Numeric Descending)

The same numeric comparison as above, but sorted from largest to smallest. Useful for finding the highest values at the top - rankings, scores, prices, or statistics.

Reverse Order

Flips the current order of lines without any sorting logic - the last line becomes the first, the second-to-last becomes the second, and so on. Use this to reverse a numbered list, flip a timeline, or undo a sort without changing the relative grouping.

Shuffle

Randomises the order of all lines using a Fisher-Yates shuffle - a statistically unbiased algorithm that gives every permutation an equal probability. Each click produces a different random order.

ModeInputOutputReach for it when
A → Zpear, apple, figapple, fig, pearNames, emails, tags
Z → Aapple, fig, pearpear, fig, appleReverse glossaries
1 → 9100, 2, 302, 30, 100Prices, IDs, scores
9 → 12, 30, 100100, 30, 2Leaderboards, top-N lists
Reversea, b, cc, b, aFlipping a changelog
Shufflea, b, cb, a, cDraw order, playlists

Sort Options

Case-Insensitive

By default, uppercase letters sort before lowercase (A sorts before a). Enable Case-insensitive to treat Apple and apple as equivalent, which is almost always what you want when sorting a real-world list of names or keywords.

Trim Lines

Strips leading and trailing whitespace from each line before sorting. This prevents lines that start with a space from being sorted ahead of lines that start with a letter, which would otherwise produce confusing results.

How to Use the Sort Lines Tool

Step 1 - Paste Your List

Click Paste to pull your list from the clipboard, or type directly into the input panel. Each line is treated as one item.

Step 2 - Select a Sort Mode

Click one of the six mode tabs at the top. The output updates automatically whenever you change the mode or modify the input.

Step 3 - Apply Options and Copy

Toggle Case-insensitive and Trim lines as needed, then click Copy output to put the sorted list on your clipboard.

Three things that trip people up

  • Numbers sorted as text. 100 lands before 2 because "1" comes before "2". Switch to numeric mode.
  • Hidden spaces. A line starting with a space sorts before everything else. Turn on Trim lines first.
  • Mixed case. Capital letters sort before lowercase by default, so Zebra beats apple. Use the case-insensitive option, or normalise first with the case converter.

Common Use Cases

Sorting Name Lists

Paste a list of attendees, contacts, or contributors and sort A → Z with Case-insensitive enabled to produce a standard alphabetical roster.

Ranking Numbers and Scores

Paste a column of scores, prices, or measurements and apply 9 → 1 to immediately see the top values. Use 1 → 9 to find the lowest values.

Randomising a Playlist or Draw Order

Paste a list of songs, names, or entries and click Shuffle to generate a random order for a playlist, prize draw, or rotation schedule.

Reversing a Timeline or Changelog

Changelogs and release notes are often written newest-first but needed oldest-first (or vice versa). Paste the entries and click Reverse to flip the order without changing anything else. If the list also has duplicates, run it through the duplicate remover first.

Natural sort, length and other orders

To alphabetize a list, use A → Z. Two orders people often expect but do not get by default:

  • Natural sortfile2 before file10. Alphabetical sorting puts file10 first because "1" precedes "2". Numeric mode fixes this when the number leads the line.
  • Sort by length — not a sort mode here. Number the lines by length with find and replace first, then sort numerically.

Worked Example

Numeric sort is the option people miss most. Alphabetical sorting puts 10 before 2:

Input:        A → Z (alphabetical):     1 → 9 (numeric):
10 apples     10 apples                  2 pears
2 pears       2 pears                    5 plums
5 plums       5 plums                    10 apples

If your lines start with numbers — quantities, prices, rankings — choose a numeric mode so values sort by magnitude instead of by first digit.

Frequently Asked Questions

What's the difference between alphabetical and numeric sorting?

Alphabetical sorting compares character by character, so "10" comes before "2" because 1 sorts before 2. Numeric sorting reads the number at the start of each line and orders by value, putting 2 before 10.

Does sorting remove duplicate lines?

No — sorting only reorders; every line you paste comes back out. To drop repeated lines, use the remove duplicates tool, which can also keep your original order.

How are uppercase and lowercase letters ordered?

By default sorting is case-sensitive, which places capitals before lowercase. Enable the case-insensitive option to interleave "apple" and "Banana" the way a dictionary would.

Is the shuffle truly random?

Shuffle uses your browser's random generator to reorder lines — fine for prize draws, playlists and test data, though not for cryptographic purposes.

Can I sort by a column in the middle of each line?

The Delimiter.site line sorter sorts by the start of each line. To sort on another field, first use the text tool to move that field to the front (for example with a search and replace), then sort.

Was this tool useful?