How Big is the Library of Babel?

One of my favorite short-story authors is the Argentinean writer Jorge Luis Borges. Many of his stories deal with mind-expanding themes, including “Blue Tigers”, about a handful of stones that do not obey the rules of mathematics, “The Book of Sand”, about a book with an infinite number of pages, and “The Aleph”, a point in space that allows one to observe all other points simultaneously.

However, Borges’ most iconic short story is the one called “The Library of Babel“, less a narrative with a plot than an extended thought experiment, about a race of people who live in a cosmos that is bizarre indeed. The universe in which these people (Babelians?) live is a vast, apparently endless honeycomb of interlocking hexagon-shaped rooms, each one with two hallways that connect it to other rooms on the same level and a spiral staircase connecting it to rooms both above and below. Every room’s walls are occupied by bookshelves that are full of books. Most of the books are complete nonsense, nothing but random combinations of letters, but a few contain tantalizing hints of sense.

One which my father saw in a hexagon on circuit fifteen ninety-four was made up of the letters MCV, perversely repeated from the first line to the last. Another (very much consulted in this area) is a mere labyrinth of letters, but the next-to-last page says Oh time thy pyramids.

As Borges’ narrator explains, the people of the Library of Babel have finally discerned the nature of their world, based on two observations: first, that every book uses the same twenty-five symbols for letters and punctuation; second, that no traveler has ever come across two exactly identical books. These people have come to the realization that the Library contains all books – that is to say, not just all books that have been written, not just all books that ever will be written, but all possible books, every single permutation of letters of a specified length.

Life in the Library is both a blessing and a curse. The vast – overwhelmingly, crushingly vast – majority of these books are total gibberish; but buried among them, somewhere, there are – there must be – books containing every truth that anyone could ever want to know.

Everything: the minutely detailed history of the future, the archangels’ autobiographies, the faithful catalogues of the Library, thousands and thousands of false catalogues, the demonstration of the fallacy of those catalogues, the demonstration of the fallacy of the true catalogue, the Gnostic gospel of Basilides, the commentary on that gospel, the commentary on the commentary on that gospel, the true story of your death, the translation of every book in all languages, the interpolations of every book in all books.

There must be books that tell the true history of the Library of Babel, and explain how such a fantastic cosmos came into existence. There must be books that contain the truth about the existence, nature, and attributes of God. There must be books that tell the true biography of every individual’s life, perfectly foretelling their every action from birth to death, if only there was a way to find them; Borges’ narrator refers to these books as the Vindications. Of course, because this library contains all possible books somewhere, every such work of perfection will be undetectably camouflaged among an immense number of sinister counterfeits – books that tell you your life story in perfect detail up to the age of thirty, say, but diverge radically thereafter.

Though it is obvious that the Library of Babel must be vast, I did not appreciate just how vast it is until reading Daniel Dennett’s discussion of it in Darwin’s Dangerous Idea. Consider: according to Borges’ description, each book in the Library is 410 pages; each page is made up of 40 lines each consisting of 80 positions, and there are 25 possible alphabetic symbols that can fill any of these positions. This works out to 410 x 40 x 80 = 1,312,000 positions per book, each of which can be filled in 25 distinct ways: 25 x 25 x 25… and so on, 1,312,000 times. In other terms, the Library of Babel contains 25(410x40x80) = 251,312,000 books. This is a number compared to which the number of atoms in our universe is infinitesimal.

Since it is all but impossible to get a handle on the size of this number, let us consider something more manageable: the number of variants of just one book, say, War and Peace. (I do not know if this book actually has something like the 1,312,000 characters possessed by each book in the Library of Babel, but say for the sake of argument that it does.) In all the vast Library there is only one book that replicates it exactly as it was written by Tolstoy. But how many slight variants are there, versions that differ by just one character?

Again, there are 1,312,000 positions in the book, each one of which can differ from the canonical version in 24 ways (since the original character at that position can be replaced with any of the other characters). Thus there are 24 x 1,312,000 = 31,488,000 one-character variants. By the same logic, there are an incredible 991,493,388,288,000, or about 991 trillion, copies of this book that vary by just two characters (31,488,000 ways to vary one character, times 24 x 1,311,999 = 31,487,976 ways to vary a different character). The number of three-character variants is exponentially larger, and the number of four-character variants larger still; and then there are the versions that differ by five, by six, by seven… (Dennett points out that even a copy with several typos on each page would still be quite recognizable.) And none of this includes translations of the book into other languages, retellings of recognizably the same story in different words, abridged versions, summaries, versions with scrambled page order, versions with alternate endings, commentaries, commentaries on the commentaries, reviews, parodies, scholarly analyses, denunciations, deconstructions…

Just how big a number is this? The estimated volume of the observable universe is 1033 cubic light-years, or about 1087 cubic centimeters. Assume that the thickness of a sheet of paper is 0.1 mm, and that each sheet is of standard 8.5 x 11-inch dimensions (about 21.6 by 28 cm). Then the volume of a single book is 21.6 x 28 x (400 x 0.01) = about 2400 cubic centimeters. It would take 4.16 x 1083 such books to completely fill the volume of the observable universe. How many variants on War and Peace would this be?

Incredibly, all the books that were exact duplicates of War and Peace, save for a mere twelve or fewer single-character differences somewhere in the text, would more than fill the observable universe. (If you’re not convinced of this, I’ve written a simple Java program that calculates the number of books in the Library of Babel that differ from a given book by X single-character changes. Download it here and check my math: And the Library of Babel must contain these books, as well as all the other character variants, plus all the other relevant books mentioned above. The amount of space required to store all these near-duplicates – Tolstoy Space, let us call it – is, by many orders of magnitude, larger than the entire observable universe. And Tolstoy Space is just the infinitesimally small, vanishing fraction of Babel Space devoted to the variants of one book. Borges wrote that for every book in the Library there were “several hundred thousand imperfect facsimiles”, but we can now appreciate just how much of an understatement that was.

Constitutional Crisis in Alabama?
Book Review: Smoke Gets In Your Eyes
New on the Guardian: Beyond Debating God’s Existence
Why Atheism Is a Force for Good
About Adam Lee

Adam Lee is an atheist writer and speaker living in New York City. His new novel, City of Light, is available in paperback and e-book. Read his full bio, or follow him on Twitter.

  • Quath

    Fun with infinities. There is a similar idea in our universe. If our universe is flat and infinite, then it has infinite matter. So take any probability, if it is finite, then it has occured an infinite number of times.

    For example, what is the probability of an Earth-like planet developing similar to Earth? What is the odds it has life? Evolves humans? Has a history similar to Earth? Produces a human with DNA identical to me in an environment extremely close to me? Has a human that has a similar life history to me?

    Whatever the probability.. say 1 in 10 to the trillionith power, it is finite and that means that there are infinite copies of me in the universe (if it is infinite).

  • Ebonmuse

    Whatever the probability.. say 1 in 10 to the trillionith power, it is finite and that means that there are infinite copies of me in the universe (if it is infinite).

    Hah, indeed. And another implication of this idea, even more bizarre: If the universe is infinite, there must be planets exactly like the Christian conceptions of Heaven and Hell. Not only that, there must also be planets exactly like the afterlife conceptions of every other religion that people have ever invented.

    It’s generally around this point that my brain starts to hurt from an overdose of philosophy and I have to go do something more useful to occupy myself. :)

  • BlackWizardMagus

    Not really; just because the universe is infinite doesn’t mean that every idea exists. I mean, heaven and hell are both, I think most of us agree, impossible; infinity doesn’t allow the impossible anymore than a finite cosmos can (finity isn’t a word, but what WOULD be the way to express that?)

  • Ebonmuse

    Okay, you’re right – anything that’s forbidden by the laws of physics can’t occur in our universe, no matter how large it is. I suppose it would be more accurate to say that if the universe is infinite, somewhere there must be planets very like the various religions’ conceptions of the afterlife.

  • BlackWizardMagus

    I think I came off harsh; sorry. But really, I would think that most planets would be very similar to earth, if they had life. I mean, the known elements in the universe are set; it would be unlikely that there is a different periodic table in the next galaxy. So, we know that conditions for life won’t change much; they must be similar to earth. So yes, there should be an infinite number of human-like beings, but furthermore, there shouldn’t be much life that’s all that different from what we see on earth.

    Actually, reflecting, most life in the universe should look simlar to what we have, or will look like that soon, or used to look like that; I suppose that an older planet, say 6 billion years, will definately have evolved forms of our creatures. Still, my point was that planet’s like heaven and hell wouldn’t really exist, not even remotely, because they wouldn’t hold life. They’d BOTH be a form of hell, then.

  • Mr. Beta

    I don’t know if it is relevant, but the universe is not believed to be infinite. I think the theory is that it is expanding at the speed of light, and has been doing so for 15 billion years.
    The theory of multible universes however, gives light to theories of unlimited possibilities: Even the ones that lie beyound our understanding of physics and causality etc.
    Wonderfull stuff.

  • Philip Thomas

    Erm, the universe can be infinite without containing every possibility. For example, one could have a universe containing an infinite amount of vaccuum. Indeed this is basically the nature of our universe, though there are some other things there too.

    I play a game set in a fantasy multiverse. The multiverse contains many “planes”, one “plane” being something like one of our ‘universes’. Some of the “planes” consist entirely of fire, or water (with some life-forms in them), others are like our own universe, and so on. But the point is, just because a “plane” is infinite doesn’t mean it contains every possible permutation.

  • Azkyroth

    While I question the applicability of Dungeons and Dragons cosmology to questions of physics, I would agree that a universe, in order to be “infinite,” need merely have infinite spatial dimensions in some meaningful sense, rather than containing every possibility of…what? *blinks*

  • Castromoya

    I think that if we are refering to spacial infinity we should then get out of the classic approach of newtonian and einsteinian physics (sorry english is my fourth lenguage) and see the idea from a superstring theory approach were all the physical posibilities can be represented given that there is enought time, a variable that becomes also infinite if you have infinite space.

  • Philip Thomas

    Sure, they all can be represented. But they don’t have to be, you could have infinite regions which contained merely one physical possibility, endlessly repeated. Unless that statement makes no sense in superstring theory, in which case I am out of my depth.

  • Alexander

    Oh come on, an infinite world cosmology simply has to contain every possible atomic structure combination: What is much more interresting is how we percieve it: Every combination of characters in a book can be read and deciphered in a thousand ways too, so every kind of data becomes more than douple ‘useless’ for the reader!
    On the subject of infinite world, we have to remember the stuff about simulated worlds in simulated worlds..

    But lets concentrate on The Library: I need some help by a mathematician to make some thesic calculations: I believe I have the theories required to make the calculations to make the calculations on where every book combination is placed from a Crimson Cubicle perspective: If the crimson book is made of a random pi based string of numbers, then we should be able to calculate where every combination is placed; That means that with some mathematical support we can make the thesic calculations on the billions of places that this text im writing is suituated within the theory of the library – and with enough calculating computerpower it should be possible to carry the calculations out.

    write me a mail if you are interested in working with me
    also if anyone has a point of view about the chaosmath possiblities in the library construction , mail me, please!
    sorry my english is not very good

    my mail is satansen(a)

  • Charles

    In an infinite universe, the Library of Babel itself will occur somewhere (or the closest physically possible approximation to it).

    This might be of interest in this context (plus some maths that might be relevant is given)

    “Parallel Universes” by Max Tegmark

  • robnjr

    An infinite set is not necessarily an exhaustive set. For example, the set of even integers is infinite, but it contains only half (OK, not really half, but you get the point) of all possible integers, leaving out the odd ones….

    Read “Infinity and the Mind” by the mathematician Rudy Rucker…..(his SF books are also mind-blowing…one of my favorite authors)….he makes exactly this point that an infinite universe is not inevitably an exhaustive one.

    Also, infinite time does not guarantee every possible outcome must eventually occur…..does “infinite time” really mater when even the proton has a half life, and eventually decays…..

    Latest evidence is that the Universe is expanding at an accelerating rate… matter and energy gets more and more diffuse, I would believe the probability of every permutation of matter occurring gets lower and lower, especially if the theorized a “big rip” happens……

  • Andrew

    It seems to me that you don’t completely answer the question of how big the library itself is. What I wondered when I read this story was how many rooms it had, and what it would take to explore the whole library, or reach it’s limit (although Borges says there is no limit, but what does he know? Has he explored the whole thing?). If my calculations are correct each room has 4 walls with 5 shelves each, and each shelf has 32 books, so 640 books per room.

    My calculator won’t let me divide 25^1,312,000 by 640, but perhaps we can estimate to 25*25, which 625 (some books were destroyed or tossed into the abyss if you recall, though probably not 15 per room). So 25^1,312,000/25^2 = 25^1,311,998. OK, that is a hell of a lot of rooms. Now lets assume that the library is a cube (though it is probably a sphere but that would be harder) – can we say that the dimensions of the library are 25^(1,311,998/3) or 25^437,333 on each side.

    Well, now, that is not so big, is it? The sucky thing is that, say you wanted to reach the edge, you might start of only 10 rooms away, but you don’t know what direction to walk, and you walk in the wrong direction! And you will never even know! Ah, life.

  • Ebonmuse

    As I recall, Borges wrote that the Library is finite but unbounded. Like the surface of a sphere, it has no edge: if you travel in the same direction for long enough, you will eventually end up back at where you started.

  • lpetrich

    Or else is a rectangle with periodic boundary conditions, giving it the topology of a torus (doughnut shape).

  • Andrew

    Well, yes the narrator said that he suspected that the library repeated after a while, but I don’t think we can really know for sure. He was just one librarian, and we all develop a certain mythology/philosophy about the world we live in… sometimes wrong, no doubt.

  • meghan

    “The sucky thing is that, say you wanted to reach the edge, you might start of only 10 rooms away, but you don’t know what direction to walk, and you walk in the wrong direction! And you will never even know! Ah, life.”

    Your comment, and the story, remind me of the film Cube. A group of people find themselves stuck in a cube which has six doors, one on every side, that bring them into identical cube rooms. They eventually realize that there are coordinates for each cube, and that they are actually within a big machine that is moving and shifting the numerous cubes regularly, only briefly giving a chance for one door to lead outside of the maze. It’s difficult to ever know how many cubes make up the entire maze, and actually figure out where one is within its structure as it moves.

  • tommy

    Thank you so much for posting the link to the Babel short story. That was easily one of the best stories I have ever read. Any tips on links to his other stories, such as “Blue Tigers”?

  • David

    Number of rooms in the library of Babel:

    You can do this with logarithms:
    There are 25^(1312000) books, if there are 640 in a room then the log of the number of rooms is:
    1312000*log(25) – log(640) = 2624000*(0.699) – 2.806

    which means there are about 1.563*10^1834173 rooms.

    By the way, if each room is 1000 cubic meters, which seems reasonable, this gives us a volume of 1.563*10^1834170 cubic meters, which is something like a cube
    10^611374 light-years on a side. This is 10^611356 times the radius of the observable universe. If you think its a long way to the drugstore . . .

    It’s big, folks.

  • derek hudson

    The number of books in the library of Babel is finite, and has been calculated. But the number of possible (impossible?) subjects SEEMS to be infinite….a book on painting the hairs on Tunisian bees….a copy of the Bible with every other word being a swear word in Spanish….a book about drinking rabbit’s blood while wearing pink boots.etc How long is the etc??? Surely I will never exhaust the list of titles I can concoct. I will I? Please help!!

  • Ebonmuse


    The answer to your dilemma is that the Library of Babel contains all possible books of a given, finite length. The total number of possible books is unlimited, but only because the potential length of a book is unlimited. That said, you can make any potential book, no matter how long, by binding together an appropriate number of volumes from the Library of Babel and treating the result as a single book.

  • derek hudson

    Thanks for answering…..BUT….given that all the books in the library ARE of a FINITE length the number of possible subjects even in books of a finite length still SEEMS to be infinite. BUT, if the library contains ALL POSSIBLE books of a finite length then, by definition, EVERY imaginable book of a finite length must be there, mustn’t it? For example, my example of “Speaking russian to widowed pink Tasmanian yaks on Tuesday mornings” MUST be there!! Am I missing something or is my logic faulty? The conflict in my mind is between the FACT that all possible books of a finite length MUST be present, but I think I can invent (write) books which are NOT there, as the number of possible subjects (even of a finite length) seems to be in finite. Am I crazy or just wrong?

  • lpetrich

    If all books with at most some length are present, then the total number is finite. But in the absence of that restriction, then the total number is infinite. In fact, it is countably infinite or countable.

    That will be the case even if one restricts the books’ contents to syntactically and semantically correct language. That can be seen by constructing a subset of such books. The first contains “This is a sentence.” The second contains “This is a sentence. This is a sentence.” The third one contains three repetitions. Etc. It can be shown that the number of such books is countable. And since the set of linguistically-correct books is a superset of that set of books and a subset of books with all possible character combinations, it also has countable size.

  • jd eveland

    I would suggest that the information content of the Universe is, if not infinitely, then at least substantially smaller than the information content of the Library. And in turn, the information content and information-processing capabilities of a human being are smaller in turn by thousands if not billions of orders of magnitude. Despite the enormous complexity of the human brain and the synaptic network enacted within it, very little of the universe is actually accessible to us. If we partition the universe of information into four quadrants based on two axes — things we know vs. things we don’t know, and things we know about vs. things we don’t know about, then all we can actually deal with is “things we know about things that we know about”. Thus while I could cheerfully spend the remainder of my corporeality spinning off verbal combinations of the “Tasmanian yak” variety, I would be utterly unable to even formulate meaningful combinations about anything in the other three quadrants. So the value of my combinatorial efforts is enhanced by my concentrating on the limited range of phenomena that I personally can affect in one way or another. And even there efficacy varies — witness my recent lack of effectiveness in preventing my retirement funds from losing half their value in a month or so.

    I think perhaps simply pulling the covers over one’s head and reading Borges with the aid of a flashlight and a topped-off snifter makes as much sense as any other intervention into the world at this point…

  • mark

    A single irrational number could in principle I think have the same information content as the entire Library. It might have to be a transcendental number as well though. But a number with an infinite decimal expansion that is utterly random could be used to encode the information in each book. If so then the entire Library exists on the number line between 0 and 1 (or a space a lot smaller, of course)!

  • Cris Comeau

    The numbers for the Library are not random and is easier to calculate to the nth digit than Pi. 0.12345678910111213… For example, The googolth and googol+1′th digits are 5 and 6. This number also includes it’s own card catalog in every base, although it has different values, such as 0.1 10 11 100 101 110 111 … in binary is approximately 0.86 in base 10, and therefore the spigot algorithm is adjusted for different bases. Base 27 would seem more appropriate for English literature. The monkeys finished their job an eternity ago. The library doesn’t need any space in the universe anymore than does Pi or e. ” 0.123…ALL 4 FREE “.

  • Boogiemanx

    Derek- All the ideas for books that you have presented are already in the collection as you are creating them with the symbols being utilized by the library. Don’t confuse ideas with presentation. As long as the ideas you have are formulated and presented by the stringing together of a selection of the 25 symbols used by the library, (e.g. “Speaking Russian to Widowed Pink Tasmanian Yaks on Tuesday Mornings”) your thoughts will never be truly infinite in nature, as you, like the library, are limiting your total conceptual output via the set of symbols you are using. It might seem like you could “outsmart” the library by coming up with yet another random series of words, but as long as you continue to use it’s limited set of symbols, the library will have already thought of it first. If you want to outsmart the library, you will need to think of an idea that cannot be presented or translated using the symbols provided. The number of ideas and concepts you can think of using the 25 symbols is large, but the use of a structured language to communicate those ideas to others inherently prevents that number from being infinite.

  • Binguslootruss

    My favorite book in the library starts out identically to the script to the imagined Broadway musical “Osprey With Pure Intentions”, but somewhere in act II it suddenly turns out that the hero & heroine are, in fact, two severed rabbit feet in a fountain which grows feathers backwards, and then rapidly degenerates into a story of lobsters and all the things they have stolen from me over the years, finally culminating in a stupendous climax of sex, gore, and betrayal around page 409, and then the last few pages contain beautiful ASCII-art renderings of hookah-smoking robots…

  • ashmeriel

    The point entirely of Borges was to obfuscate the nature of God and to elevate himself, in a blasphemous irony, to a god-like status in a universe that might itself be the conundrum of some clever, but, nonetheless very human writer. As these comments attest, Borges has set individuals speculating and arguing over the imaginary architecture of the world, just as physicists, philosophers, and theologians debate the intrinsic fabric of our own. “This is not a pipe.” And ulitmately the conundrum will give birth to a host of ideas and philosophies that will in time assume the skin and bone of religious fervor and, consequently, of oppression and liberation. God may be nothing more than an imaginative being, who, speculating on the nature of his far more complex universe, has “imagined” ours as a way of gaining insight into His. There are individuals in the Library who have created similar analogies to the library that may involve bird cages or caskets, and have become gods in their own finite, yet infinitely probable universes. What then is the point of speculation? What then is the point of investigation? If the universe is both a riddle and a joke, the dream of a charlatan, or the work of an artist, or a thing in its own right? The act of drawing two points to determine a line is both expressive and repressive, creating possibility while excluding others. Human existence is itself the ire of human existence. Borges has illustrated the most convincing portrait of hell.

  • knotty

    regarding quath’s comment: we’re really dealing with big-ass numbers, not infinities.

  • D

    I’m late to the party, but tommy asked for more stories in #19 and one of my favorites is Three Versions of Judas.

    I’m still surprised that some people think that a brute force method for creating every possible book of a given length will still leave room for something that “counting with letters” somehow omitted. Simply baffling. Of course, though you’d have every possible correct medical text, you’d have unimaginably more incorrect ones, the majority of which would contain errors subtle and lethal. Oh, man… that’s gonna blow my mind or keep me up all night… crap.

  • tritium

    Comment #13 by: robnjr has the correct treatment to this case.

    Seems there is a lot of confusion here with the Infinite. As some here have already suggested, many of you really need to study Cantor and transfinite Set Theory, before making pronouncements on topics involving the infinite.

    It is NOT necessarily true (or to be more exact, sufficient) that given an infinite amount of time… “Any type of event that has nonzero probability will happen infinitely many times”. The Set of Even numbers has the same size (cardinality) as the Set of Intergers (or Rational Numbers). However, every member of the Set of Integers is NOT in the Set of Even numbers, even though they both constitute a denumerably infinite set, and have an exact one to one correspondence.

    Discrete events in Space-Time may also be “countably” infinite and have a cardinality equal to Aleph Nought. In which case they may be infinite, but not necessarily exhaustive, just like the Even numbers are infinite, but do not contain the Odd integers.

    The same principle may apply with The Library of Babel. The total number of books would be countably infinite, with a cardinality of Aleph-nought. However, it does not follow that every possible book could be contained within.

    I especially know, for a fact, that the book “Ethel the Aardvark Goes Quantity Surveying” would NOT be found in the Library of Babel :)

  • ctd

    There is a difference between “countably infinite” vs. “really big finite”. There is a finite number of books in the Library of Babel: 25^1312000 – 1; large indeed, but hardly infinite. (The “-1″ is, of course, “Ethel the Aardvark Goes Quantity Surveying” having been deliberately destroyed, as well it should be. The Library would, however, contain both the full and expurgated versions of “Olsen’s Standard Book of British Birds”.)

    Elsewhere someone computed a sobering view of this issue: (as I recall…) should every particle in the universe be assigned a 1-byte random value, the largest string size which has a 50/50 chance of being found in that random sequence would be about … 312 characters. This rather puts monkeys pounding out a random copy of the much larger “Hamlet” at a rather, um, large (albeit not infinite) number.

  • Rollingforest

    It should be noted that many scientists believe that the universe is infinite. The big bang was not, according to them, the creation of the universe, but rather the creation of the observable universe. The infinite universe, according to them, expanded with the big bang.

    So if the universe is infinite, then no, not everything would exist, but everything that is physically possible would exist provided that matter was distributed throughout the universe. Due to quantum fluctuations and other random events, anything that could theoretically happen on earth or in space would by necessity happen because it would come up in infinite space. So there is a world where Hitler was killed in 1932 before he could take over and there is a world where he succeeded in conquering everything. There is a world exactly like this one except that you wore a different color shirt today. In an infinite universe with infinite matter, if it is physically possible it will happen.

    The library sounds incredible, but I’m not really all that impressed when I think about it further. I mean, I could, given enough time, imagine everything that had ever happened in the universe just using my own brain. I’d never know if I was right or not, but I could do it. Having every possible thing written out doesn’t do me any more good.

  • R2D221

    But you’re lying. The books from the Library of Babel only have 25 characters, which is much less than ASCII. You could do art with 25 letters, but it will hardly be comparable to real ASCII art.

    And yes, I know I’m replying 4 years after this was posted.