Christian Siedler / Flickr

Libraries tend to occupy a sacred space in modern culture. People adore them. (Perhaps even more than that, people love the idea of them. A Pew survey last year found that while people report feeling strongly about the importance of public libraries, those same people are using libraries less and less.)

The grandest libraries, built like monstrous cathedrals, are particularly beloved. It ought to follow, then, that the ultimate library—an infinite library—would be revered as a utopia, especially in an age where data is seen as its own currency. But libraries have a dark side in the cultural imagination.

In The Book of Sand, Jorge Luis Borges tells the story of an unexpected visit from a Bible salesman, who has in his collection a most unusual object. “It can’t be, but it is,” the salesman says. “The number of pages in this book is no more or less than infinite. None is the first page, none is the last.”

The strange book is so engrossing as to be sinister. This is a theme that comes up repeatedly in Borges’s work. “Paradise is a library, not a garden,” he famously said. But libraries, he warned, can be hellish, too.

The titular institution in Borges’s The Library of Babel, for example, is a universe unto its own, composed of “an indefinite perhaps infinite number of hexagonal galleries,” full of identically formatted books—“each bookshelf holds thirty-two books identical in format; each book contains four hundred ten pages; each page, forty lines; each line, approximately eighty black letters.” The appearance of order is an illusion. Many of the books contain “senseless cacophony, verbal nonsense, and incoherency,” and many of the people who are born and eventually die in the library are miserable for their fate.

“I feel in Borges a curious implication: the unrealities of physical science and the senseless repetitions of history have made the world outside the library an uninhabitable vacuum,” John Updike wrote in an essay about Borges in 1965. “Just as physical man, in his cities, has manufactured an environment whose scope and challenge and hostility eclipse that of the natural world, so literate man has heaped up a counterfeit universe capable of supporting life.”

Borges was not just interested in literary artifice, as Updike points out, but fundamentally concerned with the nature of reality, a preoccupation that often led him to interrogate the scope and organization of human knowledge. As a result, information technology—including infinite books and omniscient orbs—features prominently in his work.

In Borges’s story, The Aleph, published in 1967, he describes “a small iridescent sphere of almost intolerable brilliance,” from which it is possible to view infinite objects from all points in the universe. “I saw the heavy-laden sea,” says the narrator, also called Borges, as he describes peering into the so-called Aleph, “I saw the dawn and the dusk; I saw the multitudes of America; I saw a silver-plated cobweb at the center of a black pyramid; I saw a tattered labyrinth (it was London); I saw interminable eyes nearby looking at me as if in a mirror; I saw all the mirrors in the planet and none reflected me.”

There’s a long storytelling tradition of using fantastical information systems and otherworldly infrastructure for knowledge as a way to explore humans’ place in the larger universe. Libraries are often important, but they’re not always good. Fictional institutions differ dramatically in structure and function, but the dark undercurrent—the repository for human knowledge as a foreboding place—is a constant across countless stories.

H.P. Lovecraft’s The Shadow Out of Time features ominous beings that spend their days at a library reading “terrible books from the endless shelves and writing for hours at great tables,” cataloguing all civilizations of the past and future. “Their vast libraries housed the records of every species that had ever been or that ever would be—their arts, achievements, languages, and psychologies,” Lovecraft writes. “With this aeon-embracing knowledge, the great race chose from every era and lifeform such thoughts, arts, and processes as might suit their own nature and situation. They could mentally project themselves through time until they approached their desired period.”

In Jim C. Hines’s Libriomancer, the protagonist has the ability to reach into the pages of a book and pull out three-dimensional objects. (Including vampires, which leak out with them.) Neil Gaiman’s The Sandman features a library full of books that were dreamed into existence. Several of Isaac Asimov’s books include references to a galactic library where the entirety of human knowledge is digitally indexed in real-time. The television show Doctor Who has an two-part episode about a dying girl whose consciousness is preserved in a computer program within a planet-sized library, giving her access to all of recorded human knowledge. In all of these cases, there is a price to pay for access to remarkable troves of information.

I asked several science fiction and fantasy writers for their favorite examples of great imagined libraries. Star Trek’s Library Computer Access and Retrieval System, which powered Starfleet’s operating system, came up repeatedly. The writer Liz Williams has invented strange libraries in at least two of her works: one involves the rescue of the actual Library of Alexandria, which is then transported to another dimension; the other is a library that ends up downloaded into a female form.

Another writer, Madeline Ashby, describes an undervalued depiction of information technology in stories about Superman. “A lot of people forget that Superman's Fortress of Solitude is also a library,” she told me in an email. “It's a place for Kal-El to hide and chill (literally), but it's also the repository of all Krypton’s knowledge.” This makes for a handy expository device, Ashby says. “Superman doesn't have to draw information out via dialogue, like a detective in a mystery, he can just go grab it from one of those crystals.”It’s notable, too, that information is stored in crystal, not books. Elsewhere in science fiction and fantasy, too, writers have dispensed entirely with the notion of books as the main technology for collecting and storing human knowledge.

In Gene Wolfe’s novel, A Borrowed Man, public libraries are places where people can check out clones of dead authors. In the science-fiction classic, The World of Null-A, a city is built around a huge machine, a shining contraption that rears up several stories high from the level crest of a mountain, that tests human knowledge and divides people into knowledge-based classes.

The dystopian town at the center of the podcast Welcome to Night Vale features a public library that sometimes has no entrance, is haunted by a faceless phantom, and is run by a gang of dangerous, “long-taloned” librarians all named Randall. “We all have ambivalence toward technology,” Joseph Fink, one of Night Vale’s creators, told me last year. “It's pretty easy to amplify that.“

In the real world, the dawn of the written word incited the same kinds of anxieties that accompany any new technology that reorders people’s relationship with information. Socrates worried that writing would destroy human memory. And, indeed, the oral tradition was, across many cultures, upended by print. In the Victorian era, people were cautioned that reading fiction would make their minds atrophy. The telegraph, telephone, television, and internet, among other technologies, have all prompted similar concerns about how technology might destroy intellectual rigor.

The evolution of such fears and perceptions as they apply to information systems—from books, to machines, to artificial intelligence, and beyond—is perhaps a natural one. At the very least, it’s predictable. Books are, after all, technology. It is easy, then, to see why book-filled libraries have taken on such great technological importance in their own right. The book, Asimov claimed in 1989, in a speech to the American Booksellers Association, “will never be surpassed because it represents the minimum technology with the maximum interaction you can have.”

Humanity’s great affection for the printed word notwithstanding, it’s clear now that books have been surpassed, at least insofar as what’s possible in terms of accessing and connecting information. One wonders what Borges, who died in 1986, might have thought of the internet, which has revolutionized our expectations about how human knowledge is stored and retrieved.

Wikipedia, a vast encyclopedia that is updated continuously by tens of thousands of volunteers, is often described as impressive and ambitious, which of course it is. But it’s also important to remember that mere decades ago it was technologically impossible. A century ago, the most ambitious compendia of human knowledge in the Western world was arguably the encyclopedia. The 1911 edition of the Encyclopaedia Brittanica, as Denis Boyle writes in his new book about its history, was at the time “an inventory of the universe” practically a library all its own. Today, anyone with an internet connection has access to a staggering amount of human knowledge, more information than the thickest encyclopedias could ever have contained. Smartphones, from which people can summon answers by speaking aloud, are modern-day oracles.

No longer are encyclopedias and libraries the most ambitious ideas humans have for the collection and stewardship of knowledge. The expectation, increasingly, is that information ought not be collected in one place, but kept everywhere, so that it is accessible at all times. If the concept of an infinite book gave way to ideas for knowledge machines that now exist, today’s imagined future—with all-knowledgeable machines evolving into sentient computer minds—is more ambitious still. Ashby, the science fiction writer, gives the example of a concept explored in the film Minority Report. “Minority Report got a lot of attention for its gestural computing interface, which is lovely and delightful, but hidden in there is the idea of literally being able to page through someone's uploaded memories,” she told me.

And though brain uploading as a kind of immortality remains a beloved subject among transhumanists, today’s digital scholars are mostly fixated on figuring out how to store the seemingly endless troves of knowledge already swirling about online. These aspirations are complicated by the relative newness of web technology, and by the fact that the internet is disintegrating all the time, even as it grows. Groups like the Internet Archive are working furiously to capture data before it disappears, without any long-term infrastructure to speak of. Meanwhile, institutions like the Library of Congress are trying to figure out how the information that’s preserved ultimately ought to be organized. The hope is to reinvent the card catalogue, a system that’s already gone from analog to digital, and is now being reimagined for the semantic web.

The great paradox for those who seek to reconfigure the world’s knowledge systems, is that the real threat of information loss is occurring at a time when there seems to be no way to stop huge troves of personal data from being collected—by governments and by corporations. Like its fictional counterparts, today’s information utopia has its own sinister side.

(It’s understandable why, the journalist James Bamford has described the National Security Agency, as “an avatar of Jorge Luis Borges’ ‘Library of Babel,’ a place where the collection of information is both infinite and monstrous, where all the world’s knowledge is stored, but every word is maddeningly scrambled in an unbreakable code.”)

But there is a check on all of this anxiety about information collection and Borgesian libraries. The threat that human knowledge will be lost—either through destruction, or by dilution due to sheer scale—is still the dominant cultural narrative about libraries, real and imagined. The Library of Alexandria, often described as a physical embodiment of the heart and mind of the ancient world, is so famous today in part because it was destroyed.   

In The Book of Sand, Borges describes an infinite book that nearly drives the narrator mad before he resolves to get rid of it. “I thought of fire, but I feared that the burning of an infinite book might likewise prove infinite and suffocate the planet with smoke,” he writes. Instead, he opts to “hide a leaf in the forest” and sets off for the Argentine National Library with the bizarre volume.

“I went there and, slipping past a member of the staff and trying not to notice at what height or distance from the door, I lost the Book of Sand on one of the basement’s musty shelves.”

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.