52 factorial
The number of different orders a deck of 52 cards can be in, written out in full.
80658175170943878571660636856403766975289505440883277824000000000000
68 digits · about 8.0658 × 1067 · ends in 12 zeros
Where the famous comparison goes wrong
You may have heard that there are more ways to shuffle a deck than there are atoms in the universe. That is false, and it is off by a factor of more than a trillion.
The observable universe holds roughly 1080 atoms. 52 factorial is about 8 × 1067. So the universe wins, by about 1.24 × 1012 to one.
The true version of the claim uses Earth. Our planet holds about 1.33 × 1050 atoms, and 52 factorial is roughly 600 quadrillion times larger than that. That is still an absurd number, and it does not need exaggerating.
This is why the claim keeps turning up on r/theydidthemath. It is repeated far more often than it is checked.
Every comparison, worked out
Each row takes a published estimate, or one derived from a published measurement, and divides. Every one is linked at the bottom. The arithmetic is ours, and you can redo it.
| Compared with | How many | Against 52! |
|---|---|---|
| Grains of sand on Earth | 7.5 × 1018 | 52! is 1.08 × 1049 times more |
| Stars in the observable universe | 1024 | 52! is 8.07 × 1043 times more |
| Seconds since the Big Bang | 4.35 × 1017 | 52! is 1.85 × 1050 times more |
| Atoms in the Earth | 1.33 × 1050 | 52! is 6.06 × 1017 times more |
| Atoms in the observable universe | 1080 | 52! is 1.24 × 1012 times fewer |
Has a shuffled deck ever repeated?
Take every human being who has ever lived, about 117 billion of them. Give each one a deck at the start of the universe and have them shuffle once a second, without stopping, until today.
They would produce about 5.09 × 1028 orders. That is one part in 1.58 × 1039 of the total. Not one order in a billion billion billion billion of them.
So the honest answer is: almost certainly never, for a properly shuffled deck. That qualifier does real work. A new deck comes in a fixed order, and casinos and card rooms see the same near-orders constantly, because a bad shuffle does not reach anywhere near 52 factorial. Which is the next question.
How many shuffles does it actually take?
Seven. Dave Bayer and Persi Diaconis proved in 1992 that a 52-card deck needs about seven riffle shuffles before it is close to random. Below seven, the order left over is large enough to measure. After seven, the improvement per shuffle falls away sharply.
That is a hard thing to picture from a sentence. Here is the deck.
A sorted deck has one. A properly shuffled deck has about 26.5. Riffle it and watch.
The riffle here is the Gilbert-Shannon-Reeds model, which is the one the theorem is about: cut the deck roughly in half, then drop cards from whichever half is thicker, more often. A rising sequence is a run of consecutive cards still in order inside the deck, and counting them is how you measure what is left of the order you started with.
Orders you have generated in this browser: 0. That is 0 of 52 factorial.
This is why card magic works at all. A single cut leaves the deck in one of only 52 arrangements out of 8 × 1067, which is why a stacked deck survives being cut all evening. And it is why the tricks on this site can promise an outcome: they do not fight the number, they arrange never to depend on it.
Work out any deck
Exact, using whole-number arithmetic rather than floating point, so nothing is rounded away. Try 32 for a piquet deck, 40 for a Spanish one, or 78 for a tarot deck.
Questions people ask
What is 52 factorial?
52 × 51 × 50 and so on down to 1, which counts the different orders a 52-card deck can be in. It is a 68-digit number, printed in full at the top of this page.
Is 52 factorial bigger than the number of atoms in the universe?
No. The observable universe holds roughly 1080 atoms, about 1.24 trillion times more than 52 factorial.
The claim is true of Earth rather than the universe. Our planet has about 1.33 × 1050 atoms, and 52 factorial is around 600 quadrillion times larger than that.
How many zeros are in 52 factorial?
Twelve, at the end. Each trailing zero needs a factor of 10, which means a 5 paired with a 2, and there are far more 2s than 5s in the product.
So count the 5s: ten multiples of 5 between 1 and 52, plus one extra each from 25 and 50, since those contribute two apiece. Twelve.
Has a shuffled deck ever been in the same order twice?
Almost certainly not, for a properly shuffled deck. Everybody who has ever lived, shuffling once a second since the start of the universe, would between them have reached about one part in 1.58 × 1039 of the orders.
A badly shuffled deck is a different question, and repeats itself constantly.
How many times do you have to shuffle a deck to randomize it?
Seven riffle shuffles, from Bayer and Diaconis in 1992. Fewer leaves order a statistician can detect, and a magician can exploit.
Why does this number come up in card magic?
Because it is the size of the haystack, and every trick is a way of not searching it. A mathematical card trick works by making the outcome independent of the order, so the number stops mattering.
Where the estimates come from
- Age of the universe, 13.787 billion years: Planck Collaboration, "Planck 2018 results. VI. Cosmological parameters", Astronomy & Astrophysics 641, A6, 2020. The 4.35 × 1017 seconds in the table is that age converted.
- Atoms in the Earth, about 1.33 × 1050: derived here rather than quoted. Earth's mass is 5.97 × 1024 kg in NASA's planetary fact sheet. Divide by a mean atomic mass of about 27 grams per mole, which follows from Earth being mostly iron, oxygen, silicon, and magnesium, then multiply by Avogadro's number.
- Atoms in the observable universe, about 1080: an order-of-magnitude figure from the baryon count, not a measurement, so read the exponent loosely. It does not need to be tight. 52! falls short of it by a factor of about 1012, so this estimate could be wrong by ten orders of magnitude and the correction on this page would still hold.
- Grains of sand, about 7.5 × 1018: Howard McAllister at the University of Hawaii, reported by NPR in 2012. Sources repeat his number with two different scopes, beaches alone and beaches together with deserts, so treat it as an order of magnitude rather than a count.
- People who have ever lived, about 117 billion: Population Reference Bureau.
- Seven shuffles: Bayer, D. and Diaconis, P., "Trailing the Dovetail Shuffle to its Lair", Annals of Applied Probability 2(2), 294–313, 1992. Free to read in full.
Every estimate above is somebody else's and carries its own uncertainty. What this page adds is the division, done exactly and shown.
More
There is a shuffle that does the opposite of all this. Cut the deck into two exact halves, interlace them perfectly, and nothing is destroyed at all: eight of those and the deck is back precisely where it started. Seven imperfect shuffles to lose the order, eight perfect ones to keep it.
This sits under mathematical card tricks, which collects the tricks that run on arithmetic rather than on sleight of hand: parity, base three, arithmetic modulo 13, and one number that cancels itself out.