gives a list of all possible subsets of list.


gives all subsets containing at most n elements.


gives all subsets containing exactly n elements.


gives all subsets containing between nmin and nmax elements.


limits the result to the first s subsets.


gives if possible the s ^(th) subset.


  • Subsets[list] gives the power set of list.
  • Subsets[list] orders subsets with shortest first, and later elements in list omitted first.
  • If the elements of list are in the order returned by Sort, then the complete result from Subsets[list] will also be in this order.
  • Subsets[list,All] is equivalent to Subsets[list].
  • Subsets[list,{nmin,nmax,dn}] gives subsets containing nmin, nmin+dn, elements.
  • Subsets[list,nspec,spec] gives the same result as Take[Subsets[list,nspec],spec], provided that the elements specified by spec are present.


open allclose all

Basic Examples  (2)

All possible subsets (power set):

All possible subsets containing up to 2 elements:

Subsets containing exactly 2 elements:

Scope  (4)

The first 5 subsets containing 3 elements:

All subsets with even length:

The 69381^(st) subset:

All subsets of {a,b,c,d}:

The odd-numbered subsets of {a,b,c,d} in reverse order:

Generalizations & Extensions  (1)

Use any head:

Applications  (7)

Find all ways to pick 3 elements from 4:

Draw lines between all pairs of points in an octagon:

Construct an elementary symmetric polynomial:

All possible subsets of the divisors of 10:

Find integers that have exactly 3 nonzero binary digits:

Join all possible pairs of 20 random points in 3D:

Draw lines between all pairs of points in a cube:

Properties & Relations  (3)

Subsets picks out first the elements that appear first in the input:

Different occurrences of the same element are treated as distinct:

Tuples gives all possible combinations and reorderings of elements:

Possible Issues  (1)

Subsets[a,b,c]===Take[Subsets[a,b],c] only when all requested items are present:

When items requested by c are missing, the ones present are returned:

To suppress the warning message, use Off:

Neat Examples  (2)

Polygons formed from all possible triples of random points:

Wolfram Research (2004), Subsets, Wolfram Language function,


Wolfram Research (2004), Subsets, Wolfram Language function,


Wolfram Language. 2004. "Subsets." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2004). Subsets. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_subsets, author="Wolfram Research", title="{Subsets}", year="2004", howpublished="\url{}", note=[Accessed: 21-June-2024 ]}


@online{reference.wolfram_2024_subsets, organization={Wolfram Research}, title={Subsets}, year={2004}, url={}, note=[Accessed: 21-June-2024 ]}