tdjs.tech projects

The Library of Babel

Published 2022

A re-creation of Borges’ Library of Babel, explorable from your web browser.

https://libraryofbabel.app

An illustration of the library Source: Rice+Lipka Architects

The Library of Babel is a short story written by Jorge Luis Borges. You can read it here.

It describes a library made up of an “indefinite, perhaps infinite” number hexagonal of rooms, each lined on four sides by a bookshelf of five shelves, each self containing thirty-two books. Each book is four hundred and ten pages of forty lines, each line of eighty characters.

The character set in these books is limited to the twenty-six lower-case letters of the English alphabet, the comma, the full-stop, and the space.

In its pages, the library contains every possible combination of these characters. No two books are the same — meaning that the library is “total — perfect, complete, and whole”. Everything that ever has been, or ever will be written using these twenty-nine characters is contained somewhere within the library.

To be specific, the library contains 29131200 unique books. For comparison, we think that there are around 1080 atoms in the observable universe. So while it is not actually infinite in size, it may as well be.

This project creates a virtual version of the library that can be explored from a web browser. Each and every page is addressed by it’s location within the library, and will remain at that same address forever.

Screenshot of the landing page

You can enter the reference of a specific page to view it. Or you can jump to a random page, deep within the library, not yet discovered.

Screenshot of a page of a book on the site

You can search the library: look up some text from a book, a song, a poem or simply make something up — and find where it resides in the library. It has always been there, and always will be there. You did not create it by searching for it, you simply located it within the libraries near-infinite shelves.

Screenshot of the search page

The Library uses the GNU Multiple Precision Arithmetic Library (a.k.a GMP) to handle calculations on the huge numbers that are required to render books and search for text.

For a more detailed explanation on how it works, visit the site, read the about page, and see the README file in the GitHub repository.

Want to get in touch? You can email me at hello@tdjs.tech or message me via Twitter at @tdjsnelling.

You can also check out more work over at GitHub.