Mubarak4u

Sort lines alphabetically

Sort text lists alphabetically from A to Z or Z to A, by length, or natural numeric order. Remove duplicate lines and reverse or shuffle lists online.

Sorted Result: 0 lines | 0 duplicates removed

Use this tool to sort lines alphabetically in seconds. Paste a jumbled list, pick an order and copy out the clean result. Everything runs in your browser, so your list never leaves your device.

How to sort lines alphabetically

  1. Paste your list in “Enter or Paste Lines to Sort”, one item per line. The numbers above the box show the lines and characters.
  2. Pick the Sort Order & Method: “Alphabetical (A to Z)”, “Reverse Alphabetical (Z to A)”, “Natural Numeric (1, 2, 10…)”, “By Length (Shortest first)”, or “By Length (Longest first)”.
  3. Three boxes are already ticked: “Case-insensitive (A equals a)”, “Trim whitespace”, and “Drop blank lines”. “Remove duplicate lines” is off, so tick it if your list has repeats.
  4. Read the sorted list in Sorted Result as you type. The numbers above it show the lines and how many duplicates were removed.
  5. Click “Invert / Reverse” to flip the order, or “Random Shuffle” to mix the lines. Typing or changing the sort order brings the sorted list back.
  6. Click “Copy Sorted Lines” to copy the result, or “Reset” to start again.

How the sorting works

Alphabetical mode compares the lowercase form of each line when the case box is ticked, so “apple” and “Apple” sit together. If you untick it, the tool compares the text as typed, and capitals sort before lowercase, so Z comes before a. Natural Numeric mode uses the browser’s Intl.Collator with numbers read as whole numbers, so Item 2 comes before Item 10, and Chapter 1, Chapter 2, Chapter 11 come out in that order. Plain alphabetical mode puts Item 10 after Item 1 and before Item 2, because it compares one character at a time. By Length sorts by the number of characters in each line, and lines of the same length fall back to alphabetical order. Trim whitespace cuts spaces from both ends of every line before sorting, and Drop blank lines removes empty lines. Both are on by default. Remove duplicate lines compares lines after the case setting, so with the case box ticked, “Mumbai” and “mumbai” count as one line, and only the first copy in the sorted list is kept. The counter shows how many were removed.

What people use it for

The tool suits any list where order matters: client or student names, keyword lists, product codes and email lists that need duplicates removed. Natural Numeric is the mode for file names and headings with numbers in them, such as page 2, page 10 and page 11, which plain alphabetical order would scramble. By Length helps when you want the shortest or longest entries first, for example when checking which keywords are too long for a title.

Worked example sorting a city roster

Here is an unsorted list of regional delivery hubs with one duplicate and one lowercase name:

mumbai
Bengaluru
Delhi
mumbai
Ahmedabad
chennai

With Alphabetical (A to Z), Case-insensitive ticked and Remove duplicate lines ticked, the tool gives this sequence:

Ahmedabad
Bengaluru
chennai
Delhi
mumbai

The input has six lines and the output has five, so the counter shows 1 duplicate removed. Notice that chennai sits between Bengaluru and Delhi even though it starts with a lowercase letter. If you untick the case box, chennai moves after Delhi, because capitals sort before lowercase letters.

What this tool can’t do

The tool sorts lines and nothing else. It does not join broken lines from a copied PDF, so clean those first with the remove line breaks tool, and it does not check spelling or fix wrong words. If you untick Trim whitespace, a line with a trailing space counts as a different line, so it can survive duplicate removal and sort apart from its twin. Random Shuffle mixes the lines with a crypto random shuffle and does not remember the earlier order, so copy the sorted list before you shuffle, or type in the sort order again to bring it back. The Sorted Result box is read-only. Edit the input box and the result updates.

Frequently Asked Questions

Does sorting lines alphabetically ignore capital letters?

Yes, by default. "Case-insensitive (A equals a)" is ticked, so "apple" and "Apple" sit together and a lowercase name is placed by its letter, not pushed to the end. Untick the box if you want the text compared exactly as typed.

How do I sort a list with numbers in the right order?

Choose "Natural Numeric (1, 2, 10...)". It reads the numbers inside each line as whole numbers, so Item 2 comes before Item 10. Plain A to Z compares one character at a time and would put Item 10 before Item 2.

How do I remove duplicate lines while sorting?

Tick "Remove duplicate lines". With the case box ticked, "Mumbai" and "mumbai" count as the same line, and only the first copy in the sorted list is kept. The counter above the result shows how many were removed.

How do I sort a list in reverse order?

Pick "Reverse Alphabetical (Z to A)" in Sort Order & Method. If you have already sorted A to Z and only want to flip the result, click "Invert / Reverse" instead.

Why are blank lines missing from my result?

"Drop blank lines" is ticked by default, so empty lines are removed before sorting. If you want to keep them, untick the box. Note that "Trim whitespace" is also on by default, so a line containing only spaces counts as blank and is dropped too.

Does Trim whitespace change my text?

Yes. It cuts spaces from both ends of every line, so any indentation at the start of a line is removed in the sorted result. Untick it if your list depends on leading spaces, such as an indented outline. With it off, a line with a trailing space counts as different from the same line without one.

Is my list saved or sent anywhere?

No. The tool runs in your browser and nothing is uploaded or stored. If you refresh or close the page, your list is gone, so click Copy Sorted Lines before you leave.

Last updated: November 14, 2026