Set Cardinality Calculator
World's simplest set tool
With this online application, you can quickly find the cardinality of the given set. The input set can be written in any notation and you can adjust its style in the options. You can also use several different cardinality calculation modes to find the size of regular sets (with non-repeated elements) and multisets (with repeated elements). You can also exclude empty elements from the count. Created by team Browserling.
we have a comic!
comic for nerds
We have created our own comic! Check it out! New comics every week.
A link to this tool, including input, options and all chained tools.
Can't convert.
What is a Set Cardinality Calculator?
learn more about this tool
This browser-based program finds the cardinality of the given finite set. For any given set, the cardinality is defined as the number of elements in it. For example, if the set A is {0, 1, 2}, then its cardinality is 3, and the set B = {a, b, c, d} has a cardinality of 4. The set's size is denoted by the vertical bar characters, for example, |A| = 3 and |B| = 4. If you know the cardinality of sets, then you can compare them by size and determine which set is bigger. If the cardinality of two sets is the same, then there is a bijection between them. The input set can be specified in the standard set format, using curly brace characters { } on the sides and a comma as the element separator (for example {1, 2, 3}) and in a non-standard set format (for example [1 2 3] or <1*2*3>). To customize the input style of your set, use the input set style options. You can change the element separator and the open-set and close-set characters. If the input set is a multiset (a set that allows including the same element several times), then two additional cardinality counting modes can be useful to you. The "Count Only Unique Elements" mode counts each item only once. If any of the elements in the set are duplicated, then their copies are not included in the count. For example, the cardinality of the set A = {a, a, b} in this counting mode is 2 because "a" is a repeated element. The other cardinality counting mode "Count Only Duplicate Elements" does the opposite and counts only copies of elements. In this case, the set A = {a, a, b} has the cardinality of 1 because the element "a" is the only element that is repeated. All counting modes are connected via the relation "total elements = unique elements + repeated elements". The last checkbox "Include Empty Elements" can be very helpful in situations when the set contains empty elements. With this option, you can either include or exclude empty elements from the count. Setabulous!
Set Cardinality Calculator examples
Click to useCardinality of a Set of Primes
In this example, we paste a set of primes less than 100 in the input box and we want to find how many primes there are in this interval. The entered set uses the standard set style, namely comma-separated elements wrapped in curly brackets, so we use the comma as the number separator and braces { } as set-open and set-close symbols. We select the mode that counts all the elements in the set and find that the cardinality of this set is 25, which means there are 25 primes less than 100.
{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}
25
Required options
The element separator symbol
that goes between elements.
Open set symbol.
Close set symbol.
Count all elements in the
input set.
If the set contains blank
elements, then include
them in the count.
Size of a Set of Equations
The input set in this example is a collection of simple math expressions in variables x and y. If you look closely, you can see that some of the expressions are duplicated, which means that the input set is a multiset. To avoid counting repeated expressions, we activate the "Count Unique Elements" option. Also, to adapt the program to the non-standard set format that uses square brackets and semicolons, we put a semicolon in the set element delimiter field and square brackets in the fields for left and right set symbols.
[x; y; x + y; x + 1; y + 1; 2x; 2y; 2x + 1; 2y + 1; x²; y²; x² + 1; y² + 1; x² + x; y² + y; x² + x + 1; y² + y + 1; x; y + 1; 2y; x² + 1; y² + y; x² + x + 1]
17
Required options
The element separator symbol
that goes between elements.
Open set symbol.
Close set symbol.
If the input set is a multiset
then count only the unique
elements in it.
If the set contains blank
elements, then include
them in the count.
Unicode Checkmarks Set
In this example, the elements of the set are Unicode checkmarks that are separated by dashes. Each set element occurs at least two times and there are many empty elements in the set (between two dashes). We exclude the blank items from the count by turning off the empty element checkbox option. By using the "Count Repeated Elements" mode, we find the number of duplicate checkmarks in the set, which is 12.
✓-✅-✕- -☑-✅-✘--✔-✖-✔-✅-✘-☑--❌-✔-✗--✅-✗-✓- -✖-❌-✘
12
Required options
The element separator symbol
that goes between elements.
Open set symbol.
Close set symbol.
If the input set is a multiset
then count only the duplicate
elements in it.
If the set contains blank
elements, then include
them in the count.
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-cardinality?input=%7B2%2C%203%2C%205%2C%207%2C%2011%2C%2013%2C%2017%2C%2019%2C%2023%2C%2029%2C%2031%2C%2037%2C%2041%2C%2043%2C%2047%2C%2053%2C%2059%2C%2061%2C%2067%2C%2071%2C%2073%2C%2079%2C%2083%2C%2089%2C%2097%7D&input-separator=%2C%20&input-open-set=%7B&input-close-set=%7D&count-all=true&count-empty=true
All set tools
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.
Subscribe!
Never miss an update
Cool!
Notifications
We'll let you know when we add this tool
Cool!