deletes all duplicates from list.


applies test to pairs of elements to determine whether they should be considered duplicates.



open allclose all

Basic Examples  (2)

Delete duplicated elements:

Delete elements whose values duplicate those earlier in the association:

Scope  (3)

The list need not have head List:

Delete elements that are preceded by at least one larger element:

Treat numbers as equal if they differ by 0.01 or less:

Properties & Relations  (4)

DeleteDuplicates[list] is equivalent to DeleteDuplicates[list,SameQ]:

DeleteDuplicates is similar to Union without sorting:

Avoiding the sort improves the speed substantially:

DeleteDuplicates[list,test] applies test to two elements to determine if they are duplicates:

DeleteDuplicatesBy[list,f] transforms each element using f, then compares the results:

CountDistinct[list] is equivalent to Length[DeleteDuplicates[list]]:

CountDistinct[list,test] is equivalent to Length[DeleteDuplicates[list,test]]:

Possible Issues  (1)

If the comparison function returns neither True nor False, elements are assumed to be distinct:

Compare with the function that always reports elements as distinct:

Wolfram Research (2008), DeleteDuplicates, Wolfram Language function, (updated 2014).


Wolfram Research (2008), DeleteDuplicates, Wolfram Language function, (updated 2014).


Wolfram Language. 2008. "DeleteDuplicates." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014.


Wolfram Language. (2008). DeleteDuplicates. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2023_deleteduplicates, author="Wolfram Research", title="{DeleteDuplicates}", year="2014", howpublished="\url{}", note=[Accessed: 28-February-2024 ]}


@online{reference.wolfram_2023_deleteduplicates, organization={Wolfram Research}, title={DeleteDuplicates}, year={2014}, url={}, note=[Accessed: 28-February-2024 ]}