Natural sort order

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Natural sort order is an ordering of strings in alphabetical order, except that multi-digit numbers are ordered as a single character. Natural sort order has been promoted as being more human-friendly ("natural") than the machine-oriented pure alphabetical order.[1]

For example, in alphabetical sorting "z11" would be sorted before "z2" because "1" is sorted as smaller than "2", while in natural sorting "z2" is sorted before "z11" because "2" is sorted as smaller than "11".

Alphabetical sorting:

  1. z11
  2. z2

Natural sorting:

  1. z2
  2. z11

Functionality to sort by natural sort order is built into many programming languages and libraries.[2][3][4][5]


  1. ^ "Sorting for Humans : Natural Sort Order".
  2. ^ "PHP: natsort - Manual".
  3. ^ "Sort::Naturally -".
  4. ^ Morton, Seth M. "natsort: Simple yet flexible natural sorting in Python" – via PyPI.
  5. ^ "Customizable Natural-Order Sort - File Exchange - MATLAB Central".

External links[edit]