How it works

How a library of every possible page works

The library is one function. Give it a location and it returns a page of 3,200 letters. Give it a page and it returns the location. Nothing is stored, nothing is looked up, and nothing is predicted: every page that can be written already has an address, because every page is a number.

The shape of the library

The library is made of hexagons. Each hexagon has 4 walls of shelves, each wall 5 shelves, each shelf 32 volumes, each volume 410 pages. A page holds 40 lines of 80 characters, 3,200 in all, drawn from 29 symbols: the letters a to z, the space, the comma and the period.

That gives 293,200 distinct pages, about 104,680. Hexagons are named in base 36 (digits and letters), and there are so many that a name can be up to 3,004 characters long. A curiosity of the arithmetic: the very last hexagon holds exactly one page, on wall 1, shelf 1, volume 1.

A link to a page is the location index L itself (with any highlight folded in), written in base 64: the digits, a to z, A to Z, hyphen and underscore, at most 2,595 characters, followed by the letter c. The link says nothing about the hexagon, wall, shelf, volume or page on its face; the reader works them back out of the number. The first page of the library is /0c. That length is not waste: 293,200 pages need 15,546 bits to tell apart, and no compression can shorten a number that could be any of them.

Pages the site made for you are the exception. A random page is drawn from a 64-bit seed, and a found page is built from your text, the fill mode and a seed, so their links carry the recipe instead of the coordinates, followed by the letter r: a random page is 12 characters, a found page is about the length of the text. Your browser regenerates the page from the recipe, and walking to neighbouring pages keeps the short form, with the offset folded in. Every such page keeps its full caddress as well; the two open the same page.

1. A location is a number

Reading the hexagon name as a base-36 integer h, the location index is

L = (((h × 4 + (wall − 1)) × 5 + (shelf − 1)) × 32 + (volume − 1)) × 410 + (page − 1)

Walking to the next page adds one to L; turning the last page of a volume steps into the next volume, and so on up through shelves, walls and hexagons. The whole library is the range 0 ≤ L < 293,200.

2. The number is scrambled, reversibly

If pages were simply L written in base 29, neighbouring pages would be nearly identical and the library would be a counting exercise. So L is passed through a scramble that looks random but is exactly reversible. It is the classic linear congruential step, x → (a·x + c) mod M, with M = 293,200 and a multiplier a that is coprime to 29, which is what makes the step a bijection: every input has one output and every output one input.

A single step has a weakness: the last digits of the output depend only on the last digits of the input, so the final letter of consecutive pages would cycle in a visible pattern. The library therefore runs three rounds and, between rounds, reverses the order of all 3,200 digits, so that what was the most significant end becomes the least. After three rounds every letter of the page depends on every part of the location.

P = f₃( reverse( f₂( reverse( f₁(L) ) ) ) ), where fᵢ(x) = (aᵢ·x + cᵢ) mod M

3. The number is read as text

P is a number below 293,200, so written in base 29 it has exactly 3,200 digits (with leading zeros). Each digit from 0 to 28 is one of the 29 symbols, in order: a, b, c … z, space, comma, period. Those 3,200 symbols are the page.

Search is the same road, walked backwards

To find a text, the library first builds a full page around it (blank space, random letters, or random English words, your choice), reads that page as the number P, then undoes the three rounds in reverse order. Undoing a round isx → (x − c) · a⁻¹ mod M, where a⁻¹ is the modular inverse of the multiplier, computed once with the extended Euclidean algorithm. Out comes L, and from L the hexagon, wall, shelf, volume and page. The location is not stored anywhere; it is recomputed, identically, every time.

Why it is not a prediction machine

Videos sometimes present libraries like this one as containing "your future". They do, in the same way that a bag containing every possible lottery ticket contains the winning one. Every sentence that could be true is here, next to every sentence that could be false, and the library offers no way to tell them apart. Finding your name proves nothing except that your name is a string of letters. The arithmetic only makes that vivid.

Edition 1 constants

Every address in this library depends on six numbers, each about 15,600 bits long. They are generated deterministically from a seed phrase with the small, public sfc32 generator, so anyone can regenerate them from the source and check the test vectors. Changing any of them would move every page, so they are frozen. A future change would be published as edition 2, with edition 1 kept available.

ConstantFingerprint (base 36)
Seed phrasetotal library, edition one
M29^3200
a12yvnuk5vmmmt…ltd44mx0i6hp (3007 base-36 digits)
a2oxqz9jn3f8iw…nw44j77h3yff (3007 base-36 digits)
a35xuwrvodu1v6…6sd3yivj61gn (3007 base-36 digits)
c1ef07sve0eyrq…krm8cnzzqhfq (3007 base-36 digits)
c2awzq1k1q6y4o…fbgheph41le8 (3007 base-36 digits)
c3gc75hip4h1q3…dmpiucmq6nmi (3006 base-36 digits)

Test vector: hexagon 0, wall 1, shelf 1, volume 1, page 1 begins with the characters shown on its page. If your own implementation of the recipe above produces the same 3,200 characters, you have rebuilt this library.

Questions people ask

Is the library real, or is it a trick?

It is real mathematics and it is also, in a sense, a trick: the library does not predict anything and stores nothing. Every possible 3,200-character page corresponds to a number, and the site simply computes the number for a location, or the location for a number. Your text appears because every text of the right length appears exactly once, somewhere.

How many pages are in the library?

Every page is 3,200 characters drawn from 29 symbols, so there are 29 to the power of 3,200 pages, roughly 10 to the power of 4,680. That is unimaginably more than the number of atoms in the observable universe, which is about 10 to the power of 80.

Can I find my name, or a sentence I wrote?

Yes, as long as it fits on one page and uses the 29 letters (lowercase a to z, space, comma, period). Other characters are folded onto those. The library then computes the exact hexagon, wall, shelf, volume and page where your text sits, alone on the page or surrounded by random letters or English words, as you choose.

Do you store or send what I search for?

No. The whole computation happens in your browser; there is no search server. If you share a link to an exact-match page, the link itself contains your text, because the page is recomputed from it when the link is opened.

Does it work offline?

Yes. After the first visit the app can be installed and used with no connection, because there is nothing to download: every page is computed on your device from a few kilobytes of code.

Why only 29 characters and no capitals or digits?

The 26 letters of English plus the space, the comma and the period are enough to write any sentence, and a small alphabet keeps every page looking like prose rather than code. Capitals, digits and other punctuation are folded onto those 29 symbols when you search.

Are the links permanent?

Yes. A page address is a pure function of the constants published on this page. As long as edition 1 stands, the same address returns the same 3,200 characters, on any device, forever.

Why do almost all pages look like nonsense?

Because almost all possible pages are nonsense. Meaningful text is a vanishingly small fraction of everything that can be written, which is the unsettling point of the whole idea: the library contains every truth, every lie, and an ocean of noise around each.

Find your own text About this project