᠎᠎᠎          
51K

Set intersection calculator

World's simplest set tool
With this online application, you can quickly calculate the intersection of multiple sets and find the common elements among them. You can also intersect multisets with duplicate elements. As there are various set notations, you can change the format of the input sets as well as create a new format for the output set. Optionally, you can sort the elements of the intersection in alphabetical or alphanumerical order. Created by team Browserling.
Look what we made! Browserling
Check out our project Browserling – your personal cloud browser.
Input Sets Style
String that delimits input sets. (Three dashes by default.)
Symbol that delimits input set elements. (Comma by default.)
Open set symbol.
Close set symbol.
Output Set Style
Repeated elements are not ignored when calculating intersection of sets.
Symbol that delimits output set elements. (Comma by default.)
Open set symbol.
Close set symbol.
Intersection Sort Options
Don't sort the elements in the output set.
Sort the elements of the set intersection alphabetically.
Sort the elements of the set intersection alphabetically and numerically.

What is a set intersection calculator?

learn more about this tool
This browser-based program finds the intersection of two or more sets. The intersection of two sets A and B is a set C, such that its elements belong to both set A and set B. Similarly, the intersection of three, four, or more sets is a set that consists of common elements of all the given sets. Set intersection is a commutative binary operation and is denoted by the symbol ∩. Formally, the mathematical definition of intersection of two sets A and B is as follows: A∩B = {x: x ∈ A and x ∈ B}. For example, if the set A is {2, 4, 5, 9} and the set B is {4, 7, 8, 9}, then their intersection is the set {4, 9} (because 4 and 9 belong to both sets). If one of the sets is a subset of the other set, A ⊆ B, then A∩B = A. For example, if A = {a, b} and B = {a, b, c, d}, then A∩B = {a, b} = A. When computing the intersection operation on disjoint sets A and B (sets are disjoint if they don't share common elements), the result is the empty set with no elements in it. For example, sets {a, b} and {1, 2} are disjoint, therefore {a, b}∩{1, 2} is ∅. In the input field of this application, you can enter as many sets as you need. To indicate where one set ends and another set begins, use a delimiter string of three dashes "---". By default, this delimiter string is preconfigured in the options but you can change it to any other string that suits your needs. You can also adjust the format of the sets by changing the set braces { } to other symbols and changing the comma separator of the elements to a different separator. It's important that all input sets adhere to the same set format as configured in the options. The output set that contains the intersection can be also customized and you can specify a new set format using similar options. In the classic set theory, sets such as {a, a, a, b} and {a, b} are equal because the repeated element copies can be ignored. In our utility, we also added support for multisets. If the option "Multiset Intersection" is selected, then the repeating elements aren't ignored. With this option turned on, {a, a, b, c}∩{f, a, c, a} = {a, a, c}. Usually, the order of elements in a set isn't important, but if you need to, you can sort the elements in alphabetical or numerical order. Setabulous!

Set intersection calculator examples

Click to use
Find Common Divisors
In this example, we use the intersect operator to find the common factors of two numbers. The first set consists of all divisors of the number 12 and the second set consists of all divisors of the number 16. The intersection of these two sets contains common divisors of both integers. Both input sets use the classical set format (comma-separated elements enclosed in curly brackets). The sets themselves are separated by a line of three dashes. We preserve the input set format in the output set and find that the three common factors of integers 12 and 16 are 1, 2, and 4.
{1, 2, 3, 4, 6, 12} --- {1, 2, 4, 8, 16}
{1, 2, 4}
Required options
These options will be used automatically if you select this example.
String that delimits input sets. (Three dashes by default.)
Symbol that delimits input set elements. (Comma by default.)
Open set symbol.
Close set symbol.
Repeated elements are not ignored when calculating intersection of sets.
Symbol that delimits output set elements. (Comma by default.)
Open set symbol.
Close set symbol.
Don't sort the elements in the output set.
Find Common Letters
The input sets in this example are words enclosed in quotation marks. As funny as it may sound, the quote characters can be viewed as open and close set symbols, the letters can be viewed as set elements, and the nothing symbol (empty symbol) can be viewed as set element separator. The quotation marks indicate the beginning and end of the set, so we put them in the open-set and close-set option fields. Each letter of the word is an element of the set, so we leave the set element separator option field empty. Each word is located on a new line, so we use the newline character as individual set separator. Now when we find the intersections of these sets, it turns out the three words share only four letters. The shared letters are sorted in the output and printed as a new set in a new format with single quotes as set symbols and the space character as set element separator.
"hamster" "rhinoceros" "horse"
'e h r s'
Required options
These options will be used automatically if you select this example.
String that delimits input sets. (Three dashes by default.)
Symbol that delimits input set elements. (Comma by default.)
Open set symbol.
Close set symbol.
Repeated elements are not ignored when calculating intersection of sets.
Symbol that delimits output set elements. (Comma by default.)
Open set symbol.
Close set symbol.
Sort the elements of the set intersection alphabetically.
Multiset Intersection
In this example, we activate the "Multiset Intersection" option, which means that the intersection of sets takes into account the number of copies of repeated elements. The input sets use square brackets and are separated by the ∩ symbol. To correctly parse the input, we enter the ∩ character in the set separator field and to remove the square brackets, we type them in the set-open and set-close options, and we put a comma in the item separator field. Once the multiset intersection has been calculated, the elements are sorted in alphanumerical order. They are then separated with a semicolon, enclosed in regular parenthesis, and printed in the output area.
[x, x, y, 5, 10, -1, 3, 10] ∩ [z, x, x, 5, 10, -2, 5, 10] ∩ [x, i, x, -1, 7, 5, 10, 10]
(5; 10; 10; x; x)
Required options
These options will be used automatically if you select this example.
String that delimits input sets. (Three dashes by default.)
Symbol that delimits input set elements. (Comma by default.)
Open set symbol.
Close set symbol.
Repeated elements are not ignored when calculating intersection of sets.
Symbol that delimits output set elements. (Comma by default.)
Open set symbol.
Close set symbol.
Sort the elements of the set intersection alphabetically and numerically.
Pro tips Master online set tools
You can pass input to this tool via ?input query argument and it will automatically compute output. Here's how to type it in your browser's address bar. Click to try!
https://onlinesettools.com/find-set-intersection?input=%7B1%2C%202%2C%203%2C%204%2C%206%2C%2012%7D%0A---%0A%7B1%2C%202%2C%204%2C%208%2C%2016%7D&input-set-separator=---&input-element-separator=%2C&input-open-set=%7B&input-close-set=%7D&allow-repetitions=false&output-element-separator=%2C%20&output-open-set=%7B&output-close-set=%7D&do-not-sort=true
All set tools
Didn't find the tool you were looking for? Let us know what tool we are missing and we'll build it!
Quickly find the powerset P(S) of the given set S.
Quickly reverse the order of elements in an ordered set.
Quickly find the number of elements in a set.
Quickly apply the set union operation on two or more sets.
Quickly apply the set intersection operation on two or more sets.
Quickly apply the set difference operation on two or more sets.
Coming soon These set tools are on the way
Draw a Venn Diagram
Illustrate two or more sets as a Venn diagram.
Find Set Symmetric Difference
Apply the set difference operation on sets A and B.
Find Set Cartesian Product
Apply the set cartesian product operation on sets A and B.
Find All Subsets of a Set
Quickly find all sets that are subsets of set A.
Find All Set Permutations
Generate all permutations of set elements.
Enumerate a Set
Add numbering to all set elements.
Filter a Set
Print set elements that match a filter.
Find Set Elements
Find elements in a set that match certain criteria.
Apply a Function on a Set
Run a function on all elements in a set.
Convert a Multiset to a Set
Convert a set with repeated elements to a standard set.
Convert a Set to a Multiset
Convert a standard set to a multiset with repeated elements.
Convert a Set to a List
Create a list from the given set.
Convert a List to a Set
Create a set from the given list.
Convert a Set to an Array
Create an array from the given set.
Convert an Array to a Set
Create a set from the given array.
Duplicate Set Elements
Repeat set elements multiple times.
Print Duplicate Set Elements
Find all duplicate elements in a set.
Remove Duplicate Set Elements
Delete all duplicate elements from a set (leave unique).
Print Unique Set Elements
Find all unique elements in a set.
Remove Unique Set Elements
Delete all unique elements from a set (leave duplicates).
Remove Empty Set Elements
Delete empty elements (zero-length elements) from a set.
Find Set Depth
Calculate how many levels of subsets a set has.
Flatten a Set
Decrease subset nesting.
Truncate a Set
Remove elements from a set and make it smaller.
Truncate Set Elements
Shorten all set elements to the given length.
Expand a Set
Add elements to a set and make it bigger.
Split a Set
Split a set into a certain number of subsets.
Join Sets
Merge multiple sets together to form one large set.
Slice a Set
Extract an index-based subset from a set.
Partition a Set
Find disjoint subsets of the given set whose union is the same set.
Randomize a Set
Randomly change the order of elements in a set.
Select a Random Set Element
Pick a random element from the given set.
Select a Random Subset
Pick a random subset of the given set.
Generate an Empty Set
Create a set with no elements.
Generate a Digit Set
Create a set that contains digits.
Generate a Number Set
Create a set that contains numbers.
Generate an Integer Set
Create a set that contains integers.
Generate a Decimal Set
Create a set that contains decimal fractions.
Generate a Letter Set
Create a set that contains letters.
Generate a Character Set
Create a set that contains characters.
Generate a Word Set
Create a set that contains words.
Generate a String Set
Create a set that contains strings.
Generate a Text Set
Create a set that contains text.
Generate a Sentence Set
Create a set that contains sentences.
Generate a Random Set
Create a set that contains random elements.
Generate a Custom Set
Create a custom set with custom elements and custom size.
Generate an Infinite Set
Create a set with infinitely many elements.
Generate a Finite Set
Create a set with a finite number of elements.
Change Set Notation
Change the open-set, close-set, and element separator symbols.
Change Set Size
Add or remove set elements to make it a certain size/length.
Destroy a Set
Launch a Zalgo attack on a set and destroy it.
Compare Sets
Find all differences between two or more sets.
Symmetrize a Set
Convert a regular set to a symmetric multi-set.
Color a Set
Add colors to set elements.
Visualize a Set
Create an abstract visualization of a set.
Convert a Set to an Image
Create a downloadable picture from a set.
Print Set Analytics
Analyze a set and print its statistics.