Use this free set calculator for two numeric sets to find the union, intersection, difference and symmetric difference, showing the full result set and its size with steps.

Set Calculator

Enter two sets and get their union, intersection, difference or symmetric difference — result set and size, duplicates cleaned.

Free to use 4 set operations Duplicates auto-removed Save PDF · PNG · Share

Enter your values

Fill in the fields below — the result appears with every step shown.

Shown on the printed, PDF and PNG copies of your result. Leave blank to stay anonymous.

Enter a valid value for set a (comma separated).

Elements of the first set, e.g. 1, 2, 3, 4.

Enter a valid value for set b (comma separated).

Elements of the second set, e.g. 3, 4, 5, 6.

Enter a valid value for operation.

The set operation to apply.

Local browser calculation

Review your inputs and the tool’s supported scope before using the result.

Calculator loading… If this message stays, this view is not running the calculator's script — open this file in a full browser tab, then press Calculate.

Your result will appear here

Enter your values above, then press Calculate — or press Enter in any field.
TinyExe Set Calculator tinyexe.comFree online calculators

TinyExe · Set Result

Calculated locally in your browser

Calculated on
—

–
—

Name

—

Set A (comma separated)

—

Set B (comma separated)

—

Operation

—

How this was calculated

    What to do next

      TinyExe · tinyexe.com — Runs 100% in your browser — your numbers never leave this tab; nothing is uploaded or stored.

      TinyExe PDF & PNG exports carry the TinyExe logo and tinyexe.com header & footer.

      Runs 100% in your browser — your numbers never leave this tab; nothing is uploaded or stored.

      Embed this tool

      Add this Set Calculator to your own page — copy the code below and paste it where you want the tool to appear.

      The embed loads the live calculator in a frame, so it stays up to date automatically. Choose a width, check the code, then copy it. When you publish on WordPress, keep the src pointing at your live tool URL.

      Works in WordPress (Custom HTML block), HTML pages, and most site builders.

      The short answer

      For A = {1, 2, 3, 4} and B = {3, 4, 5, 6}, the union is {1, 2, 3, 4, 5, 6} with 6 elements, the intersection is {3, 4} with 2 elements, A minus B is {1, 2}, and the symmetric difference, elements in exactly one set, is {1, 2, 5, 6} with 4 elements.

      • Union combines both sets, each element once
      • Intersection keeps only shared elements
      • Difference A-B is not equal to B-A

      Set operation outcomes for A={1,2,3,4}, B={3,4,5,6}

      Reference values for this calculator.

      OperationResultSize
      Union{1, 2, 3, 4, 5, 6}6
      Intersection{3, 4}2
      A minus B{1, 2}2
      Symmetric difference{1, 2, 5, 6}4

      The formula

      The exact formula this calculator uses — every variable in it is explained in the card below.

      The formula

      Union A or B = every element in either set ; Intersection A and B = elements in both ; Difference A-B = elements in A but not B ; Symmetric difference = elements in exactly one set

      Performs the four core set operations on two numeric sets with duplicate removal, and reports the result set itself plus its size. Ideas enhancement: both set sizes are shown as details so the inclusion-exclusion check |A union B| = |A| + |B| - |A and B| can be verified at a glance.

      Worked examples

      Worked examples with the full working shown — try them in the calculator to check.

      Example 1

      Union of two overlapping sets

      A = {1, 2, 3, 4}, B = {3, 4, 5, 6}, operation union

      CalculationSteps
      Merge: 1, 2, 3, 4, 3, 4, 5, 6. Remove repeated 3 and 4: {1, 2, 3, 4, 5, 6}. Count = 6.Union = {1, 2, 3, 4, 5, 6}, size 6.

      Result

      Example 2

      Intersection of the same sets

      A = {1, 2, 3, 4}, B = {3, 4, 5, 6}, operation intersection

      CalculationSteps
      Check each element of A against B: 1 no, 2 no, 3 yes, 4 yes. Result {3, 4}.Intersection = {3, 4}, size 2.

      Result

      Example 3

      Symmetric difference, uneven sets

      A = {1, 2, 3}, B = {3, 4}, operation symmetric difference

      CalculationSteps
      In exactly one set: 1 and 2 are only in A, 4 is only in B, 3 is in both so it drops out. Result {1, 2, 4}.Symmetric difference = {1, 2, 4}, size 3.

      Result

      How to use this calculator

      Step 1

      Enter the elements of set A, separated by commas — duplicates are removed automatically.

      Step 2

      Enter set B the same way.

      Step 3

      Choose the operation: union, intersection, difference or symmetric difference.

      Step 4

      Read the size of the result as the main figure and the result set itself in the details.

      Step 5

      Remember difference is one-way: A minus B is not the same as B minus A.

      In short: A set is a collection of distinct elements; set operations combine two sets by rules — union (either), intersection (both), difference (in one only) and symmetric difference (in exactly one).

      Frequently asked questions

      What is the union of two sets?

      Every element that appears in A, in B, or in both, listed once. {1,2,3,4} union {3,4,5,6} = {1,2,3,4,5,6}.

      What is the intersection?

      Only the elements the two sets share. For the sets above that is {3, 4}, the overlap.

      Is A minus B the same as B minus A?

      No. A minus B keeps elements of A that B lacks ({1, 2} above); B minus A keeps {5, 6}. Difference is not commutative, unlike union and intersection.

      What does symmetric difference mean?

      The elements in exactly one of the two sets — the union with the shared overlap removed. Above it is {1, 2, 5, 6}.

      What happens if I enter a number twice?

      Sets by definition hold each element once, so duplicates are removed before the operation and the steps show the cleaned sets.

      About this calculator

      A set calculator applies the four basic operations of set theory to two collections of numbers: union, intersection, difference and symmetric difference. It returns both the resulting set itself and how many elements it contains, after removing any duplicates you entered.

      A set is defined by membership alone: an element is in or out, and repeats do not count. That is why this calculator cleans duplicates first — entering 3 twice does not make a set with two 3s, and pretending otherwise would corrupt every size it reports. The steps show the cleaned sets so you can see exactly what was operated on.

      Union and intersection are the friendly pair: they give the same answer whichever order you enter the sets. Difference is the trap — A minus B answers 'what does A have that B does not', a different question from B minus A. Symmetric difference is the 'exactly one of them' operation, useful whenever you want disagreements between two lists rather than agreements.

      The sizes obey a checkable law: |A union B| = |A| + |B| - |A intersection B|, because the shared elements get counted twice and must be handed back once. With A and B above: 4 + 4 - 2 = 6, matching the union's size.

      Use it for discrete maths homework, probability groundwork (sample spaces and events), database thinking (joins and exclusions behave like set operations), and any list-cleaning task where overlap between two lists is the question.

      How to calculate it yourself

      Step 1

      Write both sets with each element listed once.

      Step 2

      For a union, merge the lists and delete repeats.

      Step 3

      For an intersection, keep only elements appearing in both lists.

      Step 4

      For A minus B, start from A and delete anything that appears in B.

      Step 5

      For symmetric difference, merge, then delete the elements that appear in both.

      Real-life examples

      Finding customers in both campaigns

      A shop emails campaign A to customer IDs {1, 2, 3, 4} in a small test and campaign B to {3, 4, 5, 6}; the owner wants to know who received both, to avoid a third email annoying them.

      Intersection = {3, 4}, size 2. Union = {1, 2, 3, 4, 5, 6} shows 6 distinct customers were contacted in total.

      Exclude customers 3 and 4 from the follow-up send.

      Skills a team still lacks

      A project needs skills listed as set B = {3, 4, 5, 6} (coded by number); the current team covers A = {1, 2, 3, 4}. The manager needs B minus A thinking — here run as difference the other way in discussion.

      A minus B = {1, 2} shows what the team has that the project does not need; the shared core is the intersection {3, 4}.

      Two skills overlap; hiring should target the non-shared project skills.

      Ideas & use cases

      • Inclusion-exclusion practice: verify |A union B| = |A| + |B| - |intersection| on your own sets until the pattern is automatic.
      • List reconciliation: paste two ID lists as numbers to find who is on one list but not the other (difference) before merging records.
      • Probability groundwork: treat A and B as events and use the intersection size over the union size as a first feel for overlap likelihood.

      Limitations & sources

      • Numeric elements only and two sets at a time; it does not handle word elements, complements against a typed universal set, power sets or Venn diagram drawing.

      Sources: Standard set theory operations and notation (union, intersection, difference, symmetric difference) per any discrete mathematics textbook.

      Set Calculator · TinyExe calculator suite Free to use · No sign-up · Instant results