Sort lines alphabetically
Paste a list with one item per line and get it in alphabetical order, for free. Capitals and accented letters sit next to their plain letter, as in a dictionary.
Free, no sign-up, no limit Runs in your browser: your text and files are never sent or saved.
Sort lines alphabetically
How to use it
- Paste your list, one item per line.
- Pick A to Z or Z to A.
- Copy the sorted list or download it as a .txt file.
Example
Input
pear banana Éclair apple Cherry Apple item 10 item 2
Output
apple Apple banana Cherry Éclair item 2 item 10 pear
Good to know
- Alphabetical order follows English rules. The French page uses French rules.
- "Character code order" sorts like a basic computer sort: capitals first, accented letters last.
- With natural number order, "item 2" comes before "item 10". Untick it to compare digits one by one.
- "Numbers" sorts by the value of the first number in each line, with English conventions (1,250.5): 1.25 comes before 1.5 and -3 before 2. Lines without a number go to the end.
Frequently asked questions
How do I sort lines alphabetically in Word or Google Docs?
Copy the lines, paste them here and paste the sorted result back. In Word you can also select the paragraphs and use Home > Sort (the A-Z button); Google Docs has no built-in line sort without an add-on, so this page is the quickest route there.
How do I sort rows alphabetically without mixing up the data?
Copy the rows from your spreadsheet and paste them here: each row arrives as one line (cells separated by tabs), so it moves as a whole and is sorted by its first column. Paste the result back into Excel or Google Sheets and the columns line up again.
Why does “item 10” come after “item 2”?
Because “Natural number order” is on by default: numbers inside a line are compared by value, so 2 comes before 10. Untick it to compare digit by digit, as a plain computer sort does, which puts “item 10” before “item 2”.
How are capital letters and accents sorted?
As in a dictionary: “apple” and “Apple” sit together, and “Éclair” goes with the E words. Choose “Character code (ASCII)” for a basic computer sort instead: all capitals first, then lowercase, with accented letters at the end.
How do I sort lines in VS Code or Notepad++?
In VS Code, select the lines and run “Sort Lines Ascending” from the Command Palette (Ctrl+Shift+P). In Notepad++, use Edit > Line Operations > Sort Lines Lexicographically Ascending. Notepad++ puts capitals first unless you pick the “Ignoring Case” variant, and neither editor puts “item 2” before “item 10”, which the natural number order here does.
Are duplicates and blank lines kept?
Duplicates are kept by default, and identical lines stay in their original relative order. Tick “Remove duplicate lines” to keep a single copy, like sort -u. Blank lines are removed by default; untick “Remove blank lines” to keep them.