Inclusion–exclusion principle calculator
Compute the size of a union of 2 to 5 sets by inclusion–exclusion: add the individual sizes, subtract the pairwise overlaps, add back the triple overlaps, and so on, alternating signs. Work directly from your element lists — the tool sorts every element into its region and cross-checks the count — or from raw cardinalities like |A|, |A∩B|, |A∩B∩C| when you only know the counts. It shows each level's contribution and the final |A ∪ B ∪ …|.
Related tools
All Combinatorics tools →Open Inclusion–exclusion principle calculator and you get an answer straight away, with no account to create. It covers add the individual sizes, subtract the pairwise overlaps, add back the triple overlaps, and so on, alternating signs. Work directly from your element lists — the tool sorts every element into its region and cross-checks the count — or from raw cardinalities like |A|, |A∩B|, |A∩B∩C| when you only know the counts. It shows each level's contribution and the final |A ∪ B ∪ …| — adjust any of them and the result follows immediately.
How to use it
- Open the tool — no signup or install needed.
- Enter your input or adjust the available options.
- Get your result instantly, then copy or download it.
Frequently asked questions
What is Inclusion–exclusion principle calculator?
Compute the size of a union of 2 to 5 sets by inclusion–exclusion: add the individual sizes, subtract the pairwise overlaps, add back the triple overlaps, and so on, alternating signs. Work directly from your element lists — the tool sorts every element into its region and cross-checks the count — or from raw cardinalities like |A|, |A∩B|, |A∩B∩C| when you only know the counts. It shows each level's contribution and the final |A ∪ B ∪ …|.
What does a concrete case look like?
|A ∪ B| = 30 + 20 − 12 = 38 — the tool shows every step in between, not just the final figure.
What does it take into account?
It factors in add the individual sizes, subtract the pairwise overlaps, add back the triple overlaps, and so on, alternating signs. Work directly from your element lists — the tool sorts every element into its region and cross-checks the count — or from raw cardinalities like |A|, |A∩B|, |A∩B∩C| when you only know the counts. It shows each level's contribution and the final |A ∪ B ∪ …|. Change any of them and the output follows immediately.
When would I actually use this?
Counting possibilities before enumerating them: hands in a card game, passwords of a given shape, seatings around a table, or lottery odds.
What is the most common mistake?
Choosing a permutation when order does not matter. Picking three people from ten gives 720 arrangements but only 120 groups — the two differ by a factor of six here, and far more as the numbers grow.
How is Inclusion–exclusion principle calculator different from Pigeonhole principle calculator?
They sit next to each other but answer different questions: Pigeonhole principle calculator is the one to open when you need it to apply the pigeonhole principle: if N items go into M containers, at least one container must hold ⌈N/M⌉ items — no distribution can keep every container below that. Enter the items and containers to get that guaranteed minimum, and set a target k to find how many items you must place to force some container to reach k, namely M·(k−1)+1. A simple idea with surprisingly deep consequences across combinatorics and computer science. Pick whichever matches what you're starting from — both are free.
Where do the figures come from?
Counting formulas are exact by definition. Large factorials are computed with arbitrary precision where needed, so a result is not silently rounded into scientific notation.