Sort a list of lines A to Z, Z to A, by length, or by number.
How to use
- Paste one item per line.
- Choose a sort order.
- Press Sort and copy the list.
Good to know
Alphabetical sorting uses your browser locale rules, so accented letters sort sensibly.
How can you sort a list of lines alphabetically online? Use this free sort lines tool
This free online tool to sort lines alphabetically puts a list in order in one step. Paste one item per line, choose how to sort (A to Z, Z to A, shortest first, longest first or number low to high), and press the Sort button. It runs in your browser, so your list is not uploaded anywhere.
What does the Sort Lines Alphabetically tool do and why is it useful?
Unsorted lists are hard to scan, hard to compare and easy to get wrong. Sorting turns a jumble of names, tags, product titles, file names or numbers into something you can read from top to bottom. Duplicates end up next to each other, gaps are easy to see, and a list that someone else has to review becomes far friendlier.
The tool offers five sort orders in a single select box, so you can go from an alphabetical glossary to a ranking by length or a list of figures in ascending order without switching tools. It sorts lines only. It does not edit the text of any line.
How does the tool work under the hood?
The text is split into lines and the lines are reordered according to the option you pick:
- A to Z: alphabetical order using the browser's locale-aware compare. This is the same kind of comparison that language-aware sorting uses, which handles accented letters and mixed capitalisation more sensibly than a plain character-code sort.
- Z to A: the same comparison in reverse.
- Shortest first: lines are ordered by their length, from the fewest characters to the most.
- Longest first: lines are ordered by length, from the most characters to the fewest.
- Number low to high: lines are ordered by their numeric value, from the smallest number to the largest, so that 9 comes before 10.
Because alphabetical sorting uses the browser's locale compare, the exact order of special cases such as accented letters or punctuation can vary slightly between browsers and language settings. The result appears only after you press the button, and nothing updates while you type.
How do you use the tool step by step?
- Paste or type your list into the textarea, with one item on each line.
- Choose a sort order from the select: A to Z, Z to A, shortest first, longest first or number low to high.
- Press the Sort button.
- Read the sorted list in the result area.
- To try another order, change the select and press Sort again.
What do real results look like? Worked examples
Example 1: A to Z
Input, one per line: pear, apple, mango, banana
Option: A to Z
apple banana mango pear
Example 2: Z to A
Same input, option Z to A:
pear mango banana apple
Example 3: shortest first
Input: elephant, cat, bird, ox
The lengths are 8, 3, 4 and 2 characters. Option: Shortest first
ox cat bird elephant
Example 4: longest first
Same input, option Longest first:
elephant bird cat ox
Example 5: number low to high
Input: 10, 9, 100, 1 (one per line)
Option: Number low to high
1 9 10 100
This is the right choice for numbers. If the same lines were sorted as text, a typical alphabetical order would put 10 and 100 before 9, because the first character 1 comes before 9. The numeric option avoids that.
Example 6: mixed capitalisation
Input: banana, Apple, cherry
Option: A to Z
Apple banana cherry
With locale-aware comparison the capital A does not jump the queue in the way it would in a raw character-code sort, so the list reads in natural dictionary order.
Example 7: a list of file names
Input: report-final, budget, agenda, notes
Option: A to Z
agenda budget notes report-final
Which sort order should you pick?
| Goal | Best option |
|---|---|
| Dictionary order for names, words or titles | A to Z |
| Newest or last alphabetical entries on top | Z to A |
| Find the briefest entries | Shortest first |
| Find entries that may be too long for a field | Longest first |
| Figures, prices, scores or quantities | Number low to high |
If you want the highest number first, there is no dedicated descending number option, so sort low to high and read the list from the bottom up. For a ranking such as scores or prices, that is usually all you need. When you are preparing a list for someone else, it helps to say in a note which direction you sorted, since a reader cannot tell from a short list whether it runs up or down.
A second point worth remembering is that sorting is a presentation step. It never changes the content of a line, so you can sort, review and then sort again with another order without losing anything, as long as you keep your original text.
Tips and best practices
- Use Number low to high for any list of figures. Alphabetical order treats digits as text, which gives surprising results.
- Remove repeated entries first with remove duplicate lines, then sort. The result is a clean, ordered list.
- Use Shortest first to find the smallest items, for example the briefest titles in a list, and Longest first to find lines that might be too long for a field. The character counter can then confirm exact lengths.
- Put one item per line before you start. A list typed on a single line is treated as a single item.
- Sort a copy rather than your only version of the data. The tool has no history or undo.
- Clean stray spaces beforehand with remove extra spaces so that invisible gaps do not affect the result.
Common mistakes to avoid
- Sorting numbers alphabetically. This puts 100 before 9. Pick Number low to high.
- Using Number low to high on text. That option is meant for lines that are numbers. Lists of words should use A to Z or Z to A.
- Forgetting to press the button. Changing the select does not re-sort the list until you press Sort.
- Expecting length ties to be ranked alphabetically. The length options order by length. Do not assume that lines of equal length will be arranged alphabetically within their group.
- Leaving leading spaces on lines. A space at the start of a line can change where it lands in an alphabetical sort.
Who uses a line sorter?
Writers sort glossaries, bibliographies and reading lists. SEO specialists sort keyword and URL lists. Developers sort configuration entries, imports and test data so that differences are easy to spot. Teachers order class lists. Shoppers and organisers sort ingredients, tasks and packing lists. Analysts sort quick columns of numbers pasted from a spreadsheet. Anyone who needs order in a plain list without opening a spreadsheet can use it.
Is my list private?
Yes. Sorting happens in your browser. The text is not uploaded to a server and is not stored by the tool. When you close or reload the page, the content is gone. That makes it fine for contact lists, internal notes and drafts. As with any online form, avoid pasting passwords or other secrets unless you must.
What are the limitations?
- The sorted result appears only after you press Sort. There is no live updating.
- Alphabetical order follows your browser's locale rules, so unusual characters can sort slightly differently between browsers and languages.
- There are five sort orders only. It does not sort by a column, a word within the line, or by date.
- It has no file upload, download, copy button or history.
- Very large lists depend on your browser and device memory.
Frequently asked questions
How do I sort a list alphabetically?
Paste the list with one item per line, choose A to Z, and press Sort.
Does it ignore capital letters when sorting?
It uses the browser's locale-aware compare, which generally orders words in natural dictionary order instead of placing all capitals first.
How do I sort numbers correctly?
Choose Number low to high. That orders by numeric value, so 9 comes before 10.
Can I sort by line length?
Yes. Choose Shortest first or Longest first.
Does sorting remove duplicates?
No. Repeated lines stay in the list, side by side. Use Remove Duplicate Lines if you want them gone.
Why did my sort order differ from another program?
Different programs use different comparison rules. This tool uses the browser's locale compare for alphabetical order, which can differ from a simple character-code sort.
Can I sort a comma-separated list?
Not directly. Put each item on its own line first, since the tool sorts whole lines.
Put your list in order
A sorted list is easier to read, review and trust. Try the sort lines tool on your next list, and explore our other free tools for more quick text helpers.
