# Why does Android put file 10 before file 2 when sorting by name? — Adinand Auto File Sorter

Last reviewed: October 21, 2026. HTML version: https://adinandsorter.com/answers/sort-files-by-number-on-android

**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 <p>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](https://support.google.com/files/answer/9765314?hl=en), 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](https://www.samsung.com/ca/support/mobile-devices/how-to-manage-files-on-your-galaxy-phone/), and [*How to find and manage files on your Samsung Galaxy device*, Samsung Hong Kong](https://www.samsung.com/hk_en/support/mobile-devices/how-to-find-and-manage-files-on-your-samsung-galaxy-device/), 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.</p>

## The fix: pad the numbers with zeros <p>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:</p> <ul> <li>up to 99 files: two digits, `01` to `99`;</li> <li>up to 999: three, `001` to `999`;</li> <li>a series that may keep growing: one digit more than you think you need. Adding a digit later means renaming everything again.</li> </ul> <p>Renaming one file in Files by Google is a press-and-hold, **More**, **Rename** job, set out step by step on [our renaming page](https://adinandsorter.com/answers/rename-files-on-android), which also explains why a long batch is harder. Keep the extension as it was while you rename.</p>

## Dates in names follow the same rule <p>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.</p>

## Or sort by date instead <p>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](https://support.google.com/files/answer/9765018?hl=en), read 21 October 2026), which is where we would check before relying on it. Any file edited or copied later can move position.</p>

## A place you may see this with Adinand Auto File Sorter <p>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.</p>

Related: [Renaming files on Android](https://adinandsorter.com/answers/rename-files-on-android) · [Sorting files by type and date](https://adinandsorter.com/answers/sort-files-by-type-and-date) · [How to use the Google Files app](https://adinandsorter.com/answers/how-to-use-the-google-files-app) · [How Samsung My Files works](https://adinandsorter.com/answers/how-does-samsung-my-files-work)
