Macrons sorted properly

Sort lines alphabetically

Put any list in order: A to Z, Z to A, with numbers in their natural order so that 2 comes before 10, by length, or simply reversed. Letters with macrons and accents sort alongside their plain versions, so Ōamaru files with the O names rather than at the end. Equal lines keep their original order, so sorting twice never shuffles them. Paste, choose an order, copy the result.

Your list

0 lines
Tidy spaces and blank lines
Remove duplicates
Sort
Add text to each line
Split, join and line endings
Lines out0 lines in
0
Removedblank and duplicate lines
0

Why simple sorting goes wrong

Many programs sort text by the code number of each character. That puts every capital letter before every lower-case one, sends letters with macrons or accents to the very end, and treats numbers as strings of characters. This tool uses proper language-aware ordering for New Zealand English instead, which compares letters the way a dictionary or phone book does.

Numbers inside text: alphabetical versus natural

Take these chapter names: chapter 10, chapter 2, Chapter 3, chapter 21, chapter 1. Sorting by character codes gives Chapter 3, chapter 1, chapter 10, chapter 2, chapter 21: capitals first, and "10" before "2" because the character "1" comes before "2". Alphabetical (A to Z) sorting fixes the capitals but still compares digits one at a time: chapter 1, chapter 10, chapter 2, chapter 21, Chapter 3. Natural sorting reads each run of digits as a number, giving chapter 1, chapter 2, Chapter 3, chapter 10, chapter 21. Use natural order for file names, versions, invoice numbers and anything numbered.

Macrons and accents

Place names in Aotearoa often carry macrons. A naive sort puts "Ōamaru" after "Wellington" because "Ō" has a higher character code than any plain letter. Sorting with language rules treats Ō as a form of O: Arrowtown, Ōamaru, ōpōtiki, Otorohanga, Wellington, Whangārei. Lower-case and capital letters are also compared as the same letter first, with case only used to break a tie when you tick "upper case before lower case".

Other orders

  • Z to A and natural, descending give the same rules backwards.
  • Shortest first and longest first count characters as you see them, so an emoji or an accented letter counts once. Lines of the same length keep their original order.
  • Reverse the order doesn't compare anything; it flips the list upside down, which is handy for logs where the newest line is at the bottom.

Worked example: a class list by surname

Sorting compares whole lines from the first character, so a list of full names sorts by first name: Mere Tane, Ana Brown, Liam Ngata, Sofia Ahn becomes Ana Brown, Liam Ngata, Mere Tane, Sofia Ahn. To order by surname, put the surname first. Write the list as "Surname, First name", either by hand or with a formula in a spreadsheet, and the same sort gives Ahn, Sofia, Brown, Ana, Ngata, Liam, Tane, Mere. For a class or team list that's printed and pinned up, that's usually the order people look for.

Sorting one column of a spreadsheet

Copying a single column out of a spreadsheet, sorting it here and pasting it back will scramble your data, because the other columns stay where they were. This tool is for lists that stand alone: names, tags, keywords, file names. If each line belongs to a row of other information, sort inside the spreadsheet so whole rows move together. Pasting a whole row works too, but the sort then uses whatever is in the first column.

Mistakes to avoid

  • Leading spaces. A space sorts before letters, so " zebra" with a space jumps to the top. Turn on "Trim spaces" first.
  • Numbers with different formats. "1,000" and "999" sort by their digits, and natural order reads "1,000" as 1 then 000. Remove thousands separators if exact numeric order matters.
  • Expecting dates to sort. "2/10/2026" style dates don't sort chronologically as text. Year-month-day dates like 2026-10-02 do.

Your list stays in your browser. To remove repeats before sorting, see remove duplicate lines; for every option at once, use the text cleaner.

Questions people ask

Why does 10 come before 2?

Alphabetical order compares one character at a time, and "1" comes before "2". Choose "Natural (2 before 10)" to compare whole numbers by value.

Is the sort case-sensitive?

Not by default: "apple" and "Apple" are treated as the same word and keep their original order. Tick "upper case before lower case" to break ties by case.

Last reviewed: