Introduction to the Virtual Library of Babel

You may skip this page and proceed to the Library of Babel. Note: loading and initialization may take a minute or two.

The virtual scene is a 3D model of the imaginary Library of Babel, described in a famous short story by Jorge Luis Borges. The Library contains all possible books of a certain size, even if they are nonsense. This virtual Library is more restricted in content than Borges', but still unbounded. A short paper on the gallery layout was presented at the Bridges 2015 Conference. A theorem related to an inaccessibility problem discussed in the paper appears under the Notes section below.

The Library model was implemented using the Unity 3D development system for video games and other animated virtual environments. This version runs in any modern desktop browser that supports WebGL. The model data is about 20MB and may take a minute or so to load and initialize. The original Unity Webplayer version can be invoked at For a standalone version, or other questions or comments, please mail the author.

The page contents of the Library books are generated pseudorandomly, with the exception of some prefabricated pages such as the help page and some pages mentioned in the Borges story. Each book is created from a seed value based on its location in the Library (floor, gallery, shelf, etc.). Thus, book contents will be the same on each visit to the Library.

Although the story says that all book-length sequences of 22 letters and three punctuation marks are found in the Library, this virtual Library is biased toward English. It uses the 26-letter alphabet, and only spaces for punctuation. Words are at most eleven letters long, and each letter choice is influenced by the previous two letters using English statistics for trigrams (three-letter sequences), with some code due to Tom VanVleck. The one- and two-letter words are taken from a short English list.

One of the books mentioned in the Borges story contains "the letters M C V perversely repeated from the first line to the last." This book may be found close to the starting point on floor 1105 (why this floor?), circuit 15, at staircase 94, on bookcase 1, shelf 1, book 1. A book with the phrase "O Time thy pyramids" on the penultimate page (page 409) may be found one floor above somewhere in Bookcase 7. Please let me know if you find an interesting phrase on some non-prefabricated page. (For example, in 1105:15-94, bookcase 3, shelf 3, book 1, p. 47, "I am a bust" appears six lines from the bottom.)

As time goes on, more notes on current or added features will appear below on this page.

To the Library of Babel


2.3: CTL-ALT-Home enables two new features: random access to much of the library, and inclusion of externally hosted Web texts. These features are explained in separate notes below.

2.1.1: Navigation keys will change the page while reading, unless the page number field has focus.

2.0: This WebGL version is functionally the same as 1.4. The library decor has been spruced up.

1.4: The Librarian is not alone in Version 1.4!

1.3: Version 1.3 adds a limited search feature, initiated by a new button on the lower left. It searches one specified shelf at a time in the current gallery, at a rate of 30 pages per second, the frame rate of the animation. A success will show the page but not open the book. It will not find terms on prefabricated pages.

The Inaccessibility Theorem

A floor of the Library is a packed honeycomb arrangement of hexagonal galleries, unbounded in all directions. Suppose that each gallery has two exits leading to adjacent galleries; the exits link galleries into chains. If the exits may be placed differently in different galleries, there are many ways to lay them out so that all galleries on a floor are linked into a single doubly-infinite chain covering the whole floor. Floors of the virtual Library do not have a single-chain layout, for reasons discussed in the Bridges paper and in Bloch's book, cited in the paper.

The problem is that neighboring galleries cannot always be nearby on the chain, in the sense of being some fixed maximum number of galleries apart. Bloch has proved this, but his proof was omitted from his book because it was "too messy". This note offers a neat, compact proof.

We begin by defining the neighbor-local property formally. To do so, the gallery chain is represented as a numbering of the galleries, using negative as well as positive numbers, such that every gallery has a number, and galleries that share an exit have consecutive numbers. Let gn be the nth gallery. Galleries are neighbors if they share a wall, but not necessarily an exit connecting them.

Definition: A chain is neighbor-local with bound b if neighboring galleries are no more than some fixed number b of galleries apart along the chain. That is, if gm and gn are neighbors, |m - n| ≤ b.

Theorem: No chain covering a Library floor can be neighbor-local.

Proof: Let Dr be the set of galleries within a given geometric distance r from g0, where geometric distance is counted by stepping from neighbor to neighbor, regardless of exits. Thus, all six neighbors of a gallery have a geometric distance of one step from it.

If r is large enough, no neighbor-local chain can reach all galleries within Dr, so it cannot cover the whole floor. For, there are 3r(r + 1) + 1 galleries in Dr (draw a honeycomb picture to check this, it's not hard), so the shortest chain segment S that visits every gallery in Dr must be at least that long. (It can be longer because it may venture outside Dr.)

Consider the two galleries gn and gm at the two ends of chain segment S, where n ≤ 0 ≤ m. Since S is shortest, these galleries are both in Dr, so they are at most r geometric steps from g0, making them at most 2r steps apart. It follows that m - n ≤ 2br. This is because each geometric step can take at most b steps along the chain. But S covers Dr, so its length m - n ≥ 3r(r + 1) + 1. So we have 3r(r + 1) + 1 ≤ 2br. For any fixed b, we can choose r large enough to falsify this constraint. ▮

I'd like to acknowledge encouragement from William Bloch, a helpful discussion with Rich Schroeppel, and a similar question answered on the Math Stack Exchange by Gerry Myerson of Macquarie University.

Random Access

Holding Control and ALT while pressing the Home button reveals a "Passcode" field and buttons named Cancel and OK. Pressing OK after different strings are typed into the Passcode field takes the librarian to different galleries. Each passcode-linked destination gallery is somewhere in the first octant of the Library (with three non-negative coordinates).

There is a way to use this feature to direct the librarian to a chosen gallery; this is a secret. If you find it, I will put your externally hosted Vindication book publicly (if you wish) in the gallery reached by using your name as a passcode.

External Texts

The CTL-ALT-Home combination also reveals a "URL" button which, if pressed, reveals further fields to specify a Web URL and the Library location of a specific book (including bookcase, shelf, and book number). If the Enter and Done buttons are pressed, the book at that location will contain the text of the Web page at the given URL, if properly formatted. The Library Web reader does not interpret HTML, but it does use a <page> tag to end pages of text. See for an example. The Web page must be hosted somewhere accessible to your browser.

There are just a few URL entries, numbered 1, 2, 3... as shown on a button after the URL label. Pressing the number moves cyclically through the the available entries.

Books added to the library in this way are recognized as such only on your own computer, because the location information is stored in persistent cookie-like storage.