Tech
09 Sep 2026
8 min read
Why Files With Numbers in Their Names Can Sort in an Unexpected Order
You create files named photo-1, photo-2, and photo-10, then sort the folder by name. You expect 1, 2, 10. In some apps that is exactly what you get. In others, photo-10 may appear before photo-2. Nothing is necessarily wrong with the files. The difference comes from what sorting by name means to the software doing the sorting. A program can compare filenames as text, or it can recognise runs of digits as numbers and compare their numerical values. Those two rules can produce different orders from the same names.