gives a list of the elements that are the most common in list.


gives a list of the n most common elements in list.


  • When several elements occur with equal frequency, Commonest[list,] picks first the ones that occur first in list.
  • Commonest[list,n] returns the n commonest elements in the order they appear in list.
  • Commonest[list,UpTo[n]] returns the n commonest elements, or as many as are available.


open allclose all

Basic Examples  (3)

Obtain the elements with the highest frequency:

Obtain the 4 most common elements:

Obtain the 6 most common elements, or as many as there are if fewer:

Scope  (4)

Exact input yields exact output:

Approximate input yields approximate output:

Works with large arrays:

Works with data involving quantities:

Applications  (2)

Find the mode of a set of random integers:

Find the most frequently occurring elements in the columns of a matrix:

Find the mode for the heights of the children in a class:

Properties & Relations  (1)

Commonest gives elements with the largest Tally values:

Possible Issues  (1)

A message is generated if there are fewer distinct elements than requested:

Introduced in 2007
Updated in 2014