Sort Lines of Text: Alphabetical, Numeric or Natural
Sort lines is a free OpenAnyDoc tool. Drop a text file or paste a list, then pick the order for its lines.
Runs on your device: no upload, no sign-up, no ads How to check
Paste text instead
Pasted text stays in this tab and is never sent anywhere.
How it works: sort the lines of a text file
Open your list
Drop or choose a .txt file, paste the lines into the paste box, or try one of the samples. It opens in the editor with the Sort tools marked in the toolbar, and the order is not changed yet.
Pick an order
Click Sort A–Z, Sort Z–A, Natural sort or Sort by length, or open the Sort lines button for the full list with Sort numeric. Turn on Ignore case first if capital and small letters should count as the same.
Reverse, shuffle or undo
Reverse lines turns the current order upside down and Shuffle lines puts them in a random order. Each click is one undo step.
Download
Click Download to save the sorted lines as a .txt file. The file on your device is never changed.
Sort lines: what it can't do
- No fixed limit; it depends on your device's memory
- Whole lines are compared; there is no sorting by a column or field inside the line.
- Blank lines are sorted like any other line, so they gather together instead of staying between your paragraphs.
- One general alphabetical order is used for every language; a language's own alphabet rules cannot be chosen.
- Shuffle is random each time and cannot be repeated; Undo brings back the order from before.
Sorting lines: questions and answers
- Is my file uploaded?
- No, your file is not uploaded: your browser reads the text and sorts it on your device; nothing is sent to a server. To check it yourself, see how to check that a website does not upload your file.
- What is the difference between Sort A–Z and Natural sort?
- Sort A–Z compares lines character by character, so "file10" comes before "file2". Natural sort reads the digits as a number, so "file2" comes before "file10". Use natural sort for numbered names, versions and chapters.
- How do I sort lines by number?
- Open the Sort lines button and choose Sort numeric. Each line is placed by the first number in it, wherever that number is, and lines without a number go to the end.
- Can I sort only some of the lines?
- Yes, select them first; only the lines the selection touches are sorted and the rest of the text stays where it is. With nothing selected, every line is sorted.
- Can I sort by the second word or by a column?
- Not here: whole lines are compared from their first character. For a table, open the file in the CSV viewer and sort by any column.
- How do I remove repeated lines after sorting?
- Click Remove duplicate lines in the same toolbar; it keeps the first of each line. The lines do not have to be sorted first. See the Remove duplicate lines page for how lines are compared.
Why it's private: your files never leave your browser
Many online file tools upload your file, so a copy of it leaves your device. OpenAnyDoc works the other way round: your browser reads the file and draws it on your screen. Nothing is uploaded, there is no account, and the file is gone from memory when you close the tab, so there is nothing for us to store, see or lose.