Sort Lines Alphabetically, Naturally, by Number or by Length
Paste a list and sort the lines A to Z, by natural number order, by the number at the start, or by length. Remove repeats and blank lines, then copy the result. Runs in your browser.
Your text stays in this browser. Nothing is uploaded or sent to a server, and it is not put in the page address.
The tool failed to load. Please reload the page.
Report a problem or suggest an improvement
Nothing is sent until you press Send. Your measurements are included only if you tick the box, and you can see the full report below first.
When to use this
- You have a list of names, files, tags or words and want it in order.
- Your lines include numbers and plain A to Z puts item 10 before item 2.
- You also want repeats and blank lines taken out in one step.
How to use
- Paste your lines, one item per line.
- Pick how to sort. Natural order treats the numbers inside a line as numbers.
- Tick descending, case, repeat and blank line options if you need them.
- Press Sort lines, then copy the result or download it as a text file.
Examples
- Natural order: item 10, item 2, item 1 sorted naturally gives item 1, item 2, item 10. A to Z gives item 1, item 10, item 2.
- Number at the start: 30 apples, 4 pears, 200 plums sorted by the number at the start gives 4 pears, 30 apples, 200 plums.
Understanding the result
Alphabetical compares letters one by one using English order, with upper and lower case treated alike unless you turn that off. Natural order also reads runs of digits as whole numbers. Number at the start uses the first number on each line, and lines with no number go to the end. Length counts characters. Lines that tie keep their original order.
Limitations
- Other languages may expect a different order, for example letters that English does not use. Check the result if you sort non-English text.
- The number at the start must be a plain number such as 12 or 3.5. Dates, fractions and thousands separators like 1,200 are not read as numbers.
- Text is limited to 100,000 lines and 1,000,000 characters.
- Very long lists may be slow on an old phone.
FAQ
How do I sort lines alphabetically?
Paste the lines, choose Alphabetical and press Sort lines. Use the descending option for Z to A.
Why does item 10 come before item 2?
Plain alphabetical order compares one character at a time, and 1 comes before 2. Choose Natural order to sort the numbers by value.
Can I remove repeated lines at the same time?
Yes. Tick Remove repeated lines. The first copy of each line is kept, and the page says how many were removed.
What does Reverse the current order do?
It flips your list upside down without sorting it, so the last line becomes the first.
Is my text uploaded?
No. The sorting runs in your browser. Nothing you paste is sent to a server or stored, and it is not put in the page address.
Related tools
- Text
Compare Two Lists: Find What Is in One and Not the Other
Paste two lists and see the items only in A, only in B, in both, and all together, with counts and a copy button for each. Runs in your browser, nothing is uploaded.
- Dev
PX to REM Converter: Pixels, rem and em for Your Base Size
Convert px to rem and em, or rem and em back to px, for the root size you use. Get a table of common sizes you can copy into your CSS. Runs in your browser.
- Time
Timesheet Hours Calculator: Add Up Your Week
Add up hours worked from start times, end times and unpaid breaks. Get each day, the weekly total, decimal hours and the part over your weekly limit. Runs in your browser.