
Written and maintained by the PhDino author · Last reviewed 21 September 2026 · Checked against 2 independent reference calculations · how PhDino checks its numbers
How fast the space of possible logic functions explodes as the number of input variables grows.
A truth table for n boolean variables has exactly 2ⁿ rows, since each variable independently doubles the number of possible input combinations. That part is intuitive. What's much less intuitive is how many distinct boolean functions exist for those n variables: since each row of the truth table can independently be assigned a 0 or 1 output, the number of distinct possible functions is 2 raised to the power of the number of rows — 2^(2ⁿ).
That double exponential is genuinely explosive: 2 variables already allow 16 possible functions, 3 variables allow 256, and 4 variables allow 65,536 — despite the truth table itself only growing linearly in row count (4, 8, 16 rows respectively). This is the deeper reason simplification tools like Karnaugh maps and the Quine-McCluskey algorithm matter: the space of things a circuit could compute grows far faster than the table describing any one of them.
Truth table rows = 2ⁿ Possible distinct functions = 2^(2ⁿ)
Enter a number of input variables and the calculator gives two counts: the rows of the truth table, 2ⁿ, and the number of different Boolean functions those inputs can have, which is 2 raised to the number of rows. A function here means a complete truth table: one output bit chosen for every row.
Use it to get a feel for how quickly logic grows: how many cases an exhaustive test must cover, how many bits a lookup table needs, or why nobody designs logic by browsing a list of every possible function. It takes one to five inputs, because beyond that the second count becomes astronomically large.
An FPGA builds its logic from small lookup tables: a tiny memory addressed by the inputs, whose stored bits are the outputs. How many entries does a 4-input table hold, and how many different functions can it be set to?
| You enter | Value |
|---|---|
| Number of Variables | 4 |
| The calculator returns | Value |
|---|---|
| Truth Table Rows | 16 |
| Possible Boolean Functions | 65,536 |
Worked by hand:
One 4-input lookup table can therefore act as any of 65,536 functions, from AND and XOR to ones with no name at all, just by loading different bits. That flexibility is why FPGAs use tables rather than fixed gates. Add one input and the table doubles to 32 bits, but the number of functions squares: five inputs allow 4,294,967,296 of them.
The two numbers grow at very different rates. Rows double with each input, which stays manageable: 32 rows for five inputs still fits on one page. The function count is two raised to the row count, so it squares with every input, and that is what makes exhaustive approaches break down.
Sixteen. Two inputs give four rows, and 2⁴ = 16. They include AND, OR, NAND, NOR, XOR and XNOR, the two constants, each input and its complement, and four less often named ones such as "A and not B".
Because the storage doubles with every extra input while a great deal of real logic needs only a few inputs at a time. A 6-input table already holds 64 bits; much larger tables would spend memory on functions that are rarely needed.
Yes. NAND is functionally complete: NOT, AND and OR can each be made from NAND gates, so any of the counted functions can be built from them. The same is true of NOR.
No. Many different circuits implement the same function, and simplifying a design means finding a smaller circuit with the same truth table. The calculator counts truth tables, not circuits.
PhDino earns a commission on qualifying purchases made through this link, at no extra cost to you.
Code: The Hidden Language of Computer Hardware and Software by Charles Petzold — Builds from switches and logic gates up to a working computer, one clear step at a time. (Bookshop.org UK, UK delivery only)
→ The full PhDino bookshelf on Bookshop.org (UK delivery only)
