Why does Android put file 10 before file 2 when sorting by name?
Last reviewed: October 21, 2026 · Markdown version
Because the list is reading the names as text, not as numbers. Compared one character at a time, 10.jpg and
2.jpg are decided by their first characters, and 1 comes before 2, so 10 wins, along with 11 to
19. Some apps recognise runs of digits and order them as numbers; many lists do not. The reliable fix is in the names
themselves, and it takes one rename per file.
What the file managers document about it
Very little. Files by Google offers name order as one of three choices: tap More, then Sort by, and
"Select an option to sort your files by File name, Date, or Size"
(View your files, Files by Google Help, read 21 October 2026).
The page does not say how numbers inside a name are ordered; on that it is silent. Samsung's guides to My Files that we read, from its
Canadian and Hong Kong sites, do not describe the sort menu at all
(Manage and organize files saved on your Samsung Galaxy device, Samsung CA,
and How to find and manage files on your Samsung Galaxy device, Samsung Hong Kong,
both read 21 October 2026). So the only way to know what your app does is to look: put a 2 and a 10 in one folder
and sort by name.
The fix: pad the numbers with zeros
Give every number the same width. 01, 02 … 10 sort correctly in any list, because the comparison
now reaches the digit that matters at the same position in every name. Choose the width from the largest number you expect:
- up to 99 files: two digits,
01to99; - up to 999: three,
001to999; - a series that may keep growing: one digit more than you think you need. Adding a digit later means renaming everything again.
Renaming one file in Files by Google is a press-and-hold, More, Rename job, set out step by step on our renaming page, which also explains why a long batch is harder. Keep the extension as it was while you rename.
Dates in names follow the same rule
The same logic applies to dates. Written year first, with zero-padded months and days, 2026-03-07 sorts correctly by name,
where 7-3-2026 scatters across the list. If you name scans or receipts yourself, that one habit makes name order and date order
agree.
Or sort by date instead
If the files were made in the order you want, such as photos taken one after another or pages scanned in sequence, choosing Date in the same Sort by menu may give the right order with no renaming (the View your files page above). Google's page does not say which date that option uses. Its file details page lists "modified time" among what File info shows (View file information, Files by Google Help, read 21 October 2026), which is where we would check before relying on it. Any file edited or copied later can move position.
A place you may see this with Adinand Auto File Sorter
The app keeps file names as they are, with one exception: when a different file with the same name is already in the destination, the
newcomer is saved as name (1).ext, then name (2).ext, and so on. If ten or more same-named files pile up, a list
that reads names as text will show (10) before (2). Nothing is wrong with the files; it is the same ordering
effect described above.
Related: Renaming files on Android · Sorting files by type and date · How to use the Google Files app · How Samsung My Files works