sleightless.

The binary card trick

Think of a number, hand back every card it appears on, and the corner numbers of those cards add up to it. Five cards name anything from 1 to 31.

You can run it below, look up any number to see which cards hold it, and print a real set to perform with.

Do it yourself

1 Choose how high you want to count

2 Think of a number, then press every card it is on

3 Have it named

0 cards handed back
the number they add to

5

cards reach 31 · and five is the fewest possible

Why it works

Each card is one binary digit, and nothing else.

The card cornered 1 holds every number with a 1 in the ones place, which is every odd number. The card cornered 2 holds every number with a 1 in the twos place: 2, 3, 6, 7, 10, 11, and so on. Each card holds exactly half the numbers in range, and which half is decided by a single bit.

So handing back a card is not a hint. It is a statement: that digit is a 1. Five cards ask five yes-or-no questions, and five bits are all a number below 32 has. Adding the corner numbers is reading the number back out of its own spelling:

22 → on the cards cornered 2, 4 and 16
2 + 4 + 16 = 22
and 22 in binary is 10110 — the same three 1s

The spectator does the whole thing themselves. They spell their number in binary, one digit at a time, without ever saying a digit.

Why five cards, and not four or seven

n cards reach 2n − 1, because that is how many distinct answers n yes-or-no questions can have. Each card you add doubles the range:

CardsReaches
415
531
663
7127
101,023

There is a nicer fact underneath it. Binary is not simply a convenient way to build this trick — it is the most efficient one. You could work in base three, with cards asking "is your number's digit here 0, 1 or 2?", and it would still work. It would need more cards. Guglielmo Vesco proved the general case in 2025: base two needs the fewest cards, in both directions.

Look up any number

The trick run backwards. Give it a number and it will say which cards hold it, and why.

Print a set to perform with

The cards for the range you chose above, laid out to be printed and cut. Nothing is gated and there is nothing to sign up for.

Where this goes next

The same idea — ask the fewest questions that still separate everything — runs through a good deal of card magic. A de Bruijn sequence arranges a deck so that any five cards in a row name their own position in it, which is the same trick with the questions asked once instead of five times.

The other direction is a shuffle that asks no questions at all: eight perfect faro shuffles put a deck back exactly where it started, and the instruction for moving one card to any position is that position written in binary. It is this page's arithmetic, done with a whole deck.

Where this comes from

Questions people ask

How does the binary card trick work?

Each card carries one binary digit. The card cornered 1 holds every number with a 1 in the ones place, the card cornered 2 holds every number with a 1 in the twos place, and so on down the set.

Handing back a card is the same as saying that digit is a 1, so adding the corner numbers reads the number straight out of its own binary spelling.

What numbers go on each card of the binary card trick?

Card 1 holds every odd number. Card 2 holds 2, 3, 6, 7, 10, 11 and so on. In general the card cornered with a power of two holds exactly the numbers whose binary representation has that bit set, which is half of all the numbers in range.

The set above lists them in full for both ranges, and prints.

How many cards do you need for the binary card trick?

Five cards reach 31 and six reach 63, because n cards reach 2n − 1.

Base two is also the most efficient choice. Guglielmo Vesco proved in 2025 that no other base needs fewer cards, so five is not merely convenient for numbers up to 31, it is the fewest possible.

Can you do the binary card trick with numbers up to 63?

Yes. Add a sixth card cornered 32, holding every number from 32 to 63 with that bit set. Six cards reach 63, seven reach 127, and each extra card doubles the range.

The set above switches between five cards and six.

Is the binary card trick really a card trick?

It is a mathematical demonstration performed with cards rather than a sleight. Nothing is palmed, forced, or secretly counted, and the method is the same whoever holds the cards.

That is why it is used to teach binary numbers about as often as it is performed.

More

This sits under mathematical card tricks, which collects the tricks that run on arithmetic rather than on sleight of hand. The shuffle that uses this same binary instruction on a whole deck is the faro shuffle, and the shuffle that cannot spoil an order is the Gilbreath principle.