sorts the elements of list into numerical order.



open allclose all

Basic Examples  (2)

Sort by numerical value:

This may be different from the canonical expression order:

Groups of elements that can be compared with each other will typically be together in the result:

Scope  (7)

- comes before any real-valued expression, and comes after any real-valued expression:

Sort arguments of any expression:

Sort associations by numerical value:

Sort expressions of the same head by numerical value:

Complex-value expressions are sorted first by the real part and then by the absolute value of the imaginary part:

Sort quantities having compatible units:

If incompatible units are found, compatible units are grouped together:

Sort date objects:

Properties & Relations  (1)

NumericalSort uses NumericalOrder as ordering function:

Using Less as ordering function also sorts numeric expressions, but not necessarily other expressions:

Possible Issues  (1)

NumericalSort will not guarantee a particular ordering for different representations of the same number:

The canonical order will always rearrange in a definite way:

Wolfram Research (2017), NumericalSort, Wolfram Language function,


Wolfram Research (2017), NumericalSort, Wolfram Language function,


Wolfram Language. 2017. "NumericalSort." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2017). NumericalSort. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_numericalsort, author="Wolfram Research", title="{NumericalSort}", year="2017", howpublished="\url{}", note=[Accessed: 26-May-2024 ]}


@online{reference.wolfram_2024_numericalsort, organization={Wolfram Research}, title={NumericalSort}, year={2017}, url={}, note=[Accessed: 26-May-2024 ]}