Tool to generate Cartesian products of lists/sets by combining the elements to generate the complete list of possible choices.
Cartesian Product - dCode
Tag(s) : Combinatorics
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
A Cartesian product is a combination of elements from several sets. The product is written with the symbol ×. It is the totality of the possible combinations among the sets of elements.
Enter the sets (1 per line) in the generator table and click on generate.
Example: Generation of all playing card figures (jack, queen, king) of each color (spade, heart, diamond, club)
The first set consists of the 3 figures {J,Q,K}, the second set of the 4 colors {♠,♥,♦,♣}.
The Cartesian product is:
J | ♠ |
J | ♥ |
J | ♦ |
J | ♣ |
Q | ♠ |
Q | ♥ |
Q | ♦ |
Q | ♣ |
K | ♠ |
K | ♥ |
K | ♦ |
K | ♣ |
The cardinality (total number of combinations) is equal to the multiplication of the cardinality of each set.
Example: A garment with 3 color choices and 5 sizes will have $ 3 \times 5 = 15 $ different possibilities
Example: A padlock with 4 wheels that can define a 4-letter code (26 possible letters for each wheel) will have a cardinality of $ 26 \times 26 \times 26 \times 26 = 456976 $ possible words.
dCode retains ownership of the "Cartesian Product" source code. Any algorithm for the "Cartesian Product" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Cartesian Product" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Cartesian Product" or any other element are not public (except explicit open source licence like Creative Commons). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Cartesian Product" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source.
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Cartesian Product on dCode.fr [online website], retrieved on 2025-04-16,