Saved

Press the star next to a tool's name to save it.

All my tools

Sort Lines Alphabetically

Paste your list, and this tool will sort lines alphabetically, from A to Z or Z to A. It can also sort numbers naturally, remove duplicates and clear blank lines.

Each line is treated as one item.

Your text stays in your browser. Nothing is uploaded.

Sorted lines

Paste your lines and press Sort lines.

Sometimes you just need to sort lines alphabetically and get on with your work. Paste your list into this tool, and it will put every line in A to Z order in a moment, or Z to A if you prefer. You can also sort numbered items naturally, order lines by length, reverse a list or shuffle it. Along the way, the tool can remove duplicates, clear out blank lines and tidy stray spaces. It works on names, keywords, addresses, file lists and any other text with one item on each line, and your text stays in your browser.

How to sort lines alphabetically

  1. Paste your text with one item on each line.
  2. Choose a sort order, such as A to Z.
  3. Set your options for capitals, spaces, blank lines and duplicates.
  4. Press Sort lines.
  5. Copy the result and paste it wherever you need it.

The sort orders explained

  • A to Z: standard alphabetical order.
  • Z to A: the same order, backwards.
  • Natural: numbers inside a line are read as whole values.
  • Shortest first: orders lines by the number of characters.
  • Reverse current order: flips your list without sorting it.
  • Shuffle: puts the lines in a random order.

What is natural sorting?

Natural sort order treats numbers inside text as whole values, rather than as a series of separate characters. Standard alphabetical order compares one character at a time, so a file called 10.jpg comes before 2.jpg, because the character 1 comes before 2. Natural sorting puts 2.jpg before 10.jpg, which is what most people expect. Choose it for numbered files, chapters, version numbers, invoice numbers and similar lists.

Sorting example

Suppose that you paste banana, Apple, cherry and apple, one on each line. With Ignore capital letters switched on, A to Z sorts them as Apple, apple, banana and cherry. If you also choose Remove duplicate lines, the second apple is dropped and you are left with three lines. With Ignore capital letters switched off, Apple and apple count as different lines, and both of them are kept.

What are these options for?

Ignore capital letters stops capitalization from changing the order, so that Zebra doesn't jump ahead of apple. Remove spaces takes away any spaces before and after each line, which are easy to miss and can push an item to the wrong place. Remove blank lines tidies up lists that were copied from documents or web pages. Remove duplicate lines keeps the first copy of each line and removes the others.

What people use it for

  • Writing: alphabetizing bibliographies, glossaries and indexes.
  • Work: organizing customer names, product lists and email addresses.
  • Marketing: cleaning keyword lists and removing repeated terms.
  • School: ordering vocabulary lists and class rosters.
  • Programming: sorting imports, configuration values and log lines.
  • Everyday life: organizing guest lists and shopping lists.

How alphabetical order handles special cases

Lines beginning with numbers or punctuation are usually placed before those beginning with letters. Accented letters are sorted next to their plain versions, so that é is placed near e, rather than after z. Names need some thought, too. A list of full names is sorted by the first word, which is normally the first name. If you want to sort by surname, write each line with the surname first, such as Smith, Anna, before you begin.

Sorting long lists

The tool runs on your own device, so speed depends on your computer or phone. Lists of many thousands of lines should finish quickly. Very large pastes may take longer, particularly on an older phone, because the browser has to display them. If your data has several columns, it's usually better to sort it in a spreadsheet, since sorting here treats the whole line as one piece of text and won't keep separate columns apart.

Is my text private?

Yes. Sorting happens inside your browser, and your list isn't uploaded or saved. That makes it suitable for names, email addresses and other information that you wouldn't want to send to a website. When you close the page, your text is gone, so remember to copy the result first.

Sorting a list from a document or spreadsheet

When you copy a column from a spreadsheet, each cell arrives on its own line, so you can paste it straight in. Lists copied from documents can be messier, with bullet symbols or numbers at the start of each line, and these affect the order. Remove them first if you can. If your items are separated by commas instead of line breaks, replace each comma with a line break before you begin.

Common mistakes

  • Putting several items on one line. Each line is sorted as a single item.
  • Using A to Z for numbered lists. Choose Natural so that 2 comes before 10.
  • Removing duplicates with capitals counted. Apple and apple count as different unless capitals are ignored.
  • Sorting columns as text. Use a spreadsheet to keep rows together.

Count your items with the word counter, change capitals with the case converter, and check a text's length with the character counter.

What next

Use this often? Add Sort Lines A to your Home screen.

Frequently asked questions

How do I sort lines alphabetically?

Paste your list with one item per line, choose A to Z and press Sort lines.

Can it remove duplicate lines?

Yes. Turn on Remove duplicate lines, and only the first copy of each line is kept.

What is natural sort?

It reads numbers as whole values, so 2 comes before 10.

Does capitalization change the order?

Not when Ignore capital letters is on.

Is my text uploaded?

No. Everything happens in your browser.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Text & Writing Tools