Line Sorter

Text Tools

Sort lines A–Z, Z–A, by length or number

FreePrivateInstant
Add a file · .txt .md .csv .json … · up to 2.00 MB
Sort order
Embed this tool on your websiteFree
  1. Choose how tall the frame should be.
  2. Press Copy code.
  3. Paste it into your page, blog, WordPress or Notion HTML block.
Height

The tool runs inside your visitor's browser, nothing is uploaded, and a small "Powered by ToolCloak" line stays under it. The second line (script) is optional: it makes the frame fit the tool's height.

Similar tools you may like

History

All history →
About this tool

Sorting lines of text: alphabetical, numeric, by length, and the traps to avoid

A list that arrives in random order is hard to use: names for an attendance sheet, product codes, keywords, a to-do list, a column copied out of a spreadsheet. Paste it with one item per line, pick an order, and it comes back sorted. This page explains each order, and the small surprises that catch people out, such as why 10 can come before 2.

The eight orders

OrderWhat it doesGood for
A → ZAlphabetical, ascendingNames, products, glossaries
Z → AAlphabetical, descendingReverse lists, last-first views
Numeric (low → high)Sorts by the number at the start of each linePrices, marks, quantities, roll numbers
Numeric (high → low)The same, biggest firstLeaderboards, top scores
Shortest firstBy number of charactersFinding short entries, tidy display
Longest firstBy number of charactersSpotting the longest names or titles
Reverse current orderFlips the list upside down, without sortingOldest-first to newest-first
Random shuffleA new random order every timeDraws, quiz questions, fair turns

The three switches

The number of lines in the final list is shown under the result.

  • Case sensitive (off by default). Off means “apple” and “Apple” are treated alike when sorting. On makes capital and small letters count as different.
  • Trim spaces (on by default). Removes spaces at the start and end of each line, so an accidental leading space does not push an item to the wrong place.
  • Remove blank lines (on by default). Empty lines are dropped. Turn it off if the gaps matter to you.

Why 10 comes before 2

If you pick A → Z for a list of numbers, you get 1, 10, 2, 20, 3. That is not a mistake. Alphabetical order compares character by character, and the character “1” comes before “2”, so “10” goes ahead of “2”. For numbers, always choose Numeric.

In numeric mode the tool reads the number at the start of each line, ignoring commas, so 1,250 is read as 1250 and 42 apples is read as 42. Lines that do not start with a number are not lost. They are grouped at one end of the list: the end for low → high, and the start for high → low.

Dates need a particular format

Dates written as 25-12-2026 or 03/08/2025 do not sort correctly in alphabetical order, because the day comes first. The year is the most important part, so it should come first. Write dates as 2026-12-25 (year-month-day), and then even a plain A → Z sort puts them in true calendar order. This one habit makes dates sortable everywhere: file names, spreadsheets, logs.

Accents, capitals and other languages

Alphabetical sorting follows your browser’s language rules, not raw character codes. That is why “Émile” lands near “Emile” and not at the very end, which is what you want in a name list. Sorting also works for lists in Hindi and other scripts, following the browser’s order for that script.

With Case sensitive on, the order of “a” and “A” comes from those same language rules, where a small letter normally comes just before its capital. It is not the old computer order, where every capital letter came before every small letter. If you need a strict code-based order, check the result carefully.

Real situations

  • Attendance and class lists. Paste the names, sort A → Z, and print.
  • Keyword lists for SEO or ads. Alphabetical order makes duplicates and near-duplicates easy to spot.
  • Price and marks lists. Sort numerically to find the top and bottom.
  • Inventory and product codes. Put similar codes next to each other.
  • Tidying a spreadsheet column copied into a notes app before it goes back.
  • Fair draws and quiz order. Shuffle a list of names or questions. A shuffle is fine for fun and classroom use. For a draw with something valuable at stake, use a dedicated spinner or random picker so everyone can watch.
  • Preparing two lists to compare. If you sort both lists the same way, the differences in the Text Diff tool become much easier to read.

What the tool does not do

  • It does not remove duplicates. Equal lines stay next to each other, which makes them easy to see, and you can remove them with the Remove Duplicate Lines tool.
  • It sorts whole lines. To sort the words inside one line, use a word sorter.
  • It does not sort by a column inside a line. For tables with many columns, a spreadsheet is the right place.

Privacy

Sorting is done in your browser, and your list is not uploaded or saved. It is fine for a class register, a customer list or a set of internal codes.

Line Sorter — at a glance

Put any list in order in one click — alphabetical, by number, by length, or even shuffled.

Your list
pear
apple
mango
Run
Sorted
apple
mango
pear

How to use it — step by step

A list with one item on each line. Names, keywords, numbers, links or code lines all work.

1

Paste your input

Paste or type your content into the big input box.

2

Choose options

Pick the mode and options that fit what you need.

3

Sort Lines

Press the button. The result is created instantly on your device.

4

Copy the result

Check the output and press Copy to use it anywhere.

Pro tips

Small things that make the result better.

✦Use Numeric order for prices or IDs so 10 comes after 9, not after 1.
✦Turn on Trim spaces to stop invisible spaces from changing the order.
✦Use Random shuffle to draw a fair random order for a giveaway or team list.

Quick facts

8 modesA–Z, Z–A, number, length, reverse, shuffle
Unlimitedlines, no cap
Cleantrim spaces and blank lines
Privatenothing is uploaded

Frequently Asked Questions

What is Line Sorter?+

Sort any list line by line in alphabetical, reverse, numeric, length-based or random order. Choose case sensitivity, trim spaces and skip blank lines — perfect for name lists, keywords, data cleanup and code.

How do I use Line Sorter?+

Open Line Sorter on this page, then: 1. Paste your input 2. Choose options 3. Sort Lines 4. Copy the result. Everything runs in your browser on a phone or computer.

Is Line Sorter free to use?+

Yes. Line Sorter on Toolcloak is free, needs no signup and has no hidden limits.

How does numeric sorting work?+

Lines are read as numbers, so 2 comes before 10. Lines that are not numbers are placed at the end.

Is sorting case sensitive?+

Only if you turn on Case sensitive. By default “apple” and “Apple” are treated the same.

Can I sort a CSV column?+

Yes — paste one value per line, sort, then copy the result back.

Is my data safe?+

Yes. Everything runs inside your own browser. Your text, files and images are never uploaded to any server.

Also searched as: line sorter · sort lines alphabetically · sort text online · alphabetical sorter · sort list a to z · line sorter tool

More Free Tools