Subset Calculator - Total, Proper, and k-Sized Subsets
Use this subset calculator to count every subset of a set with n elements, including total, nonempty, proper, and k-sized subsets via 2^n and C(n,k).
Subset Calculator
Results
What Is a Subset Calculator?
A subset calculator counts every subset of a finite set whose size you know, and can also count subsets of a specific size. Type the number of elements n in the original set, type the optional subset size k, and the page returns the total number of subsets, the number of proper and nonempty subsets, and the binomial coefficient C(n,k) for subsets of size k. Each element is either in or out of a subset, which is why the total count grows as 2^n.
- • Discrete math and counting homework: Confirm answers for problems that ask how many subsets, how many proper subsets, or how many k-element subsets a set has.
- • Probability and combinatorics prep: Power the binomial coefficient step in probability problems, Pascal's triangle work, and the first counting step in a larger combinatorial argument.
- • Computer science and bitmask enumeration: Enumerate the 2^n bitmasks of an n-bit register, count nonempty bitmasks, and check the number of masks of a given Hamming weight k.
- • Survey and option-set planning: Estimate how many possible option combinations exist when a customer can pick or skip each of n options in a survey, menu, or product configurator.
The page is intentionally small: one set size, one optional subset size, and the counts that fall directly out of the power set. If your next step is a factorial or a permutation, the peer calculators in the same family take you there without re-entering the numbers.
When the subset count reduces to a factorial form like n! / (k! (n - k)!), the Factorial Calculator page turns the same n and k into a direct factorial result.
How the Subset Calculator Works
The page runs the standard power set count and the binomial coefficient formula. It treats every subset as a yes/no decision for each element of the original set, then multiplies those decisions together.
- n: Number of elements in the original set, a non-negative integer.
- k: Optional subset size to count subsets of a specific cardinality.
- 2^n: Total number of subsets of an n-element set, including the empty set and the full set.
- C(n, k): Number of ways to choose k elements from n distinct elements.
- n! / (k! * (n - k)!): Factorial form of the binomial coefficient.
For n up to 53 the page shows 2^n with a thousands separator. Above 53 the page switches to scientific notation and uses a BigInt-backed binomial coefficient so every digit stays correct. The factorial form pairs naturally with a factorial step.
Worked example: a 4-element set with k = 2
n = 4 elements, subset size k = 2.
2^4 = 16 total subsets. C(4, 2) = 4! / (2! * 2!) = 24 / 4 = 6 subsets of size 2. Proper subsets = 2^4 - 1 = 15. Nonempty proper subsets = 2^4 - 2 = 14.
Total subsets: 16. Subsets of size 2: 6. Proper subsets: 15. Nonempty proper subsets: 14.
For a 4-element set, you can pick any 2 of the 4 elements in 6 ways. The full set is one of the 16 subsets, so the other 15 are proper subsets, and 14 of those are not the empty set.
According to Wolfram MathWorld, a set with n elements has exactly 2^n subsets, the cardinality of its power set, because each element is independently included or excluded.
If your counting problem needs permutations P(n, k) alongside combinations C(n, k), the Permutation and Combination Calculator page returns both from the same n and k inputs.
Key Concepts Behind Subset Counting
Four ideas explain where the 2^n and C(n, k) formulas come from and what the numbers really mean in a set.
Power set of a set
The power set of S is the set of all subsets of S, including the empty set and S itself. For a set with n elements the power set has 2^n members.
Binomial coefficient C(n, k)
C(n, k) is the number of ways to choose k elements from a set of n distinct elements. The page computes C(n, k) = n! / (k! (n - k)!), the same value that appears in Pascal's triangle.
Proper versus improper subsets
A proper subset of S is any subset that is not S itself, so the empty set counts as a proper subset. Improper subsets include the full set S. The number of proper subsets is 2^n - 1; nonempty proper subsets is 2^n - 2.
Nonempty and empty subsets
The empty set is one of the 2^n subsets for any n. Removing it leaves the nonempty subsets, of which there are 2^n - 1. The identity 2^n = 1 + (2^n - 1) is a useful sanity check.
These four concepts are the building blocks for any counting problem that starts with a set. Most of the time you only need 2^n and C(n, k), and the rest of the page just spells out which subsets each one counts.
When the binomial coefficient C(n, k) feeds into a probability problem with a fixed success probability, the Binomial Distribution Calculator page turns the same n, k, and p into a binomial probability.
How to Use This Subset Calculator
Five short steps cover every common case, from a clean textbook example to a counting problem with a specific subset size k.
- 1 Enter the set size n: Type the number of elements in the original set. Default is n = 4; the page also accepts n = 0 for the empty set.
- 2 Enter the subset size k: Type the cardinality of the subsets to count, or leave k = 2 for the default. k can be 0 to count the empty subset or k = n to count the full set.
- 3 Read the total subset count: The primary output is 2^n, the size of the power set. It matches whether you count subsets of n elements or bitmasks of n bits.
- 4 Check the proper and nonempty counts: The page also shows proper subsets (2^n - 1) and nonempty proper subsets (2^n - 2), the counts that most problems need.
- 5 Reset or extend: Click Reset to return to the example. If your next step is a permutation or a probability calculation that uses C(n, k), open the peer calculators in the same family.
Try n = 6 and k = 3. The page returns 64 total, 63 nonempty, 63 proper, 62 nonempty proper, and 20 subsets of size 3 because C(6, 3) = 20. With 6 bits you can write 2^6 = 64 distinct bitmasks, exactly the power set of a 6-element set.
Once 2^n passes the thousands-separated integer format, the Exponential Notation Calculator page returns the same count in standard scientific notation with mantissa and exponent, which is the easiest form to paste into a worksheet or report.
Benefits of Using This Subset Calculator
These benefits matter most when you are working a counting problem by hand and need a quick check.
- • Skip the off-by-one mistakes: The 2^n versus 2^n - 1 versus 2^n - 2 trap is the most common error in subset counting. The page shows all four counts together so the right number is obvious.
- • Get C(n, k) without the factorial gymnastics: Computing C(n, k) by hand means reducing n! / (k! (n - k)!) step by step, which is easy to get wrong. The page does the reduction in one pass.
- • Handle small and large n the same way: Small n shows thousands-separated integers; n above 53 uses scientific notation and a BigInt-backed binomial coefficient.
- • Connect to permutations, factorials, and binomial probabilities: The page links to the closest peer calculators for the next step in a counting problem.
- • Check power set and bitmask enumerations: For 2^n bitmasks of an n-bit register, the page returns the same 2^n you would enumerate in code, and C(n, k) gives the number of bitmasks with exactly k bits set.
Use this page to confirm a counting answer, sanity-check a bitmask enumeration, or pre-validate a k-sized subset count before you hand it to a longer script.
For 2^n counts that the page renders in scientific notation, the Exponent Calculator page returns the same value in base-2 power form with the exponent written explicitly, so the result reads like a textbook answer even when n is large.
Factors That Affect Subset Counts
The formulas are fixed, but a few factors change how the result should be read and which count is the one a counting problem actually needs.
Empty set (n = 0)
The empty set has exactly one subset: itself. The page returns 1 total, 0 nonempty, 0 proper, 0 nonempty proper. C(0, 0) = 1; C(0, k) = 0 for k > 0.
Subset size k = 0
C(n, 0) is always 1, the empty subset. The total is still 2^n, and the empty subset is one of the 2^n members of the power set.
Subset size k = n
C(n, n) is 1, the full set. This is the only way to choose n elements from n elements, and the page reflects that even when n is large.
Subset size k greater than n
C(n, k) is 0 because there is no way to pick k elements from fewer than k. The page returns 0 and a short note so it is not mistaken for an error.
Number size at high n
For n above 53, 2^n no longer fits in a regular JavaScript number, so the page switches to scientific notation. C(n, k) is computed with BigInt arithmetic to keep every digit correct.
- • This page counts subsets of a single set with one fixed size n. For a counting problem with two sets and an intersection, union, or difference, the page does not compute those set operations.
- • The counts assume all n elements of the original set are distinct. Repeated elements can lower the actual number of distinct subsets below 2^n because some subsets collapse into each other.
- • C(n, k) is the count of subsets, not the count of orderings. For ordered k-tuples of distinct elements, the formula is the permutation n! / (n - k)!, not the binomial coefficient.
According to Wolfram MathWorld, the number of k-element subsets of an n-element set is the binomial coefficient C(n,k) = n! / (k! (n - k)!), and C(n,k) is zero when k is greater than n.
When the k-sized subset count C(n, k) becomes a probability question with a success probability p, the Probability Calculator page takes the same n and k alongside p and returns a numeric probability from 0 to 1, which is a different result from the count on this page.
Frequently Asked Questions
Q: How many subsets does a set with n elements have?
A: A set with n elements has 2^n subsets, including the empty set and the full set. The result is the cardinality of the power set, and it grows by a factor of 2 every time you add one element to the original set.
Q: What is the formula for the number of subsets of size k?
A: The formula is the binomial coefficient C(n, k) = n! / (k! (n - k)!). Pick k elements from the original n, then divide by the permutations of the k picks and the permutations of the (n - k) elements that stay out, leaving the number of distinct k-sized subsets.
Q: How do I count proper subsets versus all subsets?
A: All subsets count is 2^n. Proper subsets are all subsets except the full set, so the count is 2^n - 1. Nonempty proper subsets exclude the empty set as well, so the count is 2^n - 2. Most counting problems pick one of these three, and the page shows all three at once.
Q: What is the difference between a subset and a proper subset?
A: A subset of S can be any subset of S, including S itself and the empty set. A proper subset of S is any subset that is not equal to S, so the empty set is a proper subset. Subset is the broader term, and proper subset is the stricter one.
Q: Can the number of subsets be zero?
A: The total number of subsets of a set is 2^n, and the smallest value of 2^n is 1 at n = 0, when the original set is the empty set. The number of nonempty subsets can be 0 (at n = 0), and the number of subsets of a specific size k can be 0 when k is greater than n.
Q: How is the number of subsets related to the power set?
A: The power set of a set S is the set of all subsets of S. Its cardinality is 2^|S|, so the number of subsets and the size of the power set are the same number. The page reports the power set size and the subset count together, with 2^n as the primary output.