Cartesian Product

Cartesian product of two sets as ordered pairs.

About this tool

Cartesian product

A × B contains every ordered pair (a, b), with a from A and b from B. Order matters: A × B generally differs from B × A. Repeated values count once; an empty set gives an empty product.

Separate string values with spaces, commas or semicolons. Outer braces are optional. Quote values containing separators or braces, such as "red, blue". Inside quotes, escape a quote or backslash with a backslash. "" is a valid empty string. Values are case-sensitive strings: 01 and 1 differ.

Calculate displays at most 400 pairs. Each set allows 400 distinct values and 20,000 characters. Edits clear the result; saved inputs do not calculate automatically.