Home / Calculators / Set Operations Calculator
Free online tool

Set Operations Calculator

Calculate union, intersection, A minus B and symmetric difference of two finite text sets. Processing takes place locally in your browser.

Start using

Set Operations Calculator

Enter exactly two non-empty lines: the first is set A and the second is set B. Items on each line are separated by commas, spaces or their supported full-width comma equivalent.

The two sets may contain up to 20000 items in total, with at most 100 UTF-16 code units per item. Duplicate values within a line are automatically collapsed by set semantics.

Output contains A union B, A intersection B, A minus B and the symmetric difference. For A=1,2,3 and B=3,4,5 the intersection is 3 and the union is 1,2,3,4,5.

Values are compared as case-sensitive text. The result preserves first-seen insertion order; it does not numerically sort items or coerce numeric-looking strings.

Whitespace cannot be retained inside a single item, and commas cannot be escaped. The page does not calculate Cartesian products, multisets, fuzzy sets or set cardinality separately.

Enter exactly two lines: set A first and set B second

Both sets must contain at least one item; together they may contain at most 20000 items, each at most 100 UTF-16 code units

Input must not exceed 500000 UTF-16 code units

Limits count the supplied items before duplicate removal. Separate items with , or , or whitespace within each line. Arabic ، and Japanese 、 are ordinary item text, not separators. Do not include A:, B: or braces around the example input. After editing, calculate again and copy the result; Clear removes both the input and result. There is no file download or separate B−A result.

Processing takes place locally in your browser.