Carl Sagan “was practically the face of science in this country for a long, long time,” historian Leonard Bruno said. “He made science cool.” (Eduardo Castaneda)

The life of Carl Sagan now fills the tabletops of two vast rooms in the Madison Building of the Library of Congress. The life arrived in recent weeks at the building’s loading dock on 41 pallets containing 798 boxes.

Sagan famously talked about billions of stars and billions of galaxies, and it appears that he saved roughly that many pieces of paper.

The material documents Sagan’s energetic career as an astronomer, author, unrivaled popularizer of science and TV star, and it ranges from childhood report cards to college term papers to eloquent letters written just before his untimely death in 1996 at age 62. Also in the mix are files labeled F/C, for “fissured ceramics,” Sagan’s code name for letters from crackpots.

And there’s this, from Johnny Carson, after Sagan declared that he’d never actually used the much-satirized phrase “billions and billions” on “The Tonight Show”: “Even if you didn’t say ‘billions and billions’ you should have. — Johnny.”

Until recently, all this stuff had been stacked in filing cabinet drawers in the Sphinx Head, a tomblike secret-society building that became Sagan’s home in Ithaca, N.Y. For years, Sagan’s widow, Ann Druyan, had carefully preserved her husband’s archive, hoping to find an appropriate repository. The Library of Congress had long been interested; the library owns the papers of such innovators and scientific luminaries as Alexander Graham Bell, the Wright brothers, J. Robert Oppenheimer, E.O. Wilson and Margaret Mead.

Ann Druyan and Carl Sagan in 1988. (Copyright Jon Crispin/CRISPIN/REYNOLDS PHOTOGRAPHY)

Along came Seth MacFarlane, creator of TV’s “Family Guy” (and director of the new movie “Ted”). Astrophysicist Neil deGrasse Tyson introduced MacFarlane to Druyan when Tyson and Druyan were developing a remake of the enormously popular 1980 PBS series “Cosmos” that made Sagan famous. In the process of backing the new “Cosmos,” MacFarlane provided an undisclosed sum of money to the Library of Congress to buy the archive from Druyan. The library will officially announce the acquisition Wednesday.

Now comes the arduous task of sorting through it. The boxes fill two sprawling rooms. The organization of the archive is expected to be completed by November 2013, at which point the material will be open to researchers.

“He was practically the face of science in this country for a long, long time,” said Leonard Bruno, a historian specializing in science, who recommended that the library obtain the material and who is retiring later this week. “He made science cool.”

Druyan said of her late husband, “He wasn’t a pack rat at all. But I think he had a sense of his place in cultural history. I think he knew he was corresponding with the great and the near-great both inside and outside of science.”

Library officials let a Washington Post reporter spend a couple of hours going through a few select boxes.

Sagan was, one quickly discovers, a phenom.

“If you wish to gain information concerning anything, go to Carl Sagan. He is Noah Webster, Einstein, and a walking encyclopedia all rolled into one. (There is a streak of John Barrymore in his nature, also.),” wrote the student newspaper at Rahway (N.J.) High School in 1950.

The archive includes documents related to Sagan’s controversial hypothesis that an all-out nuclear war would result in a “nuclear winter.” It also includes letters to and from Sagan during a painful episode when the National Academy of Sciences declined to extend him membership (some scientists had sniffed that Sagan was a popularizer whose scientific work wasn’t of the highest merit, but other colleagues defended him, noting, for example, that he did early, significant work showing that a greenhouse effect broiled the surface of Venus and that dust storms on Mars explained changing features seen through telescopes.

There’s fascinating correspondence between ordinary people and the famous scientist. Sagan was both a promoter of science and its gatekeeper, remaining skeptical of paranormal claims and UFO reports. The trick was to be a defender of science without being a scold. To one correspondent, Sagan gently asked “only that you be open to the possibility that you are wrong, and not confuse what feels good with what’s true.”

A sampling of the “fissured ceramics” letters that he received after he became famous with “Cosmos”:

●“I have discovered a planet between Venus and the earth. . . . I am in Attica Correctional Facility and am unable to check out this discovery further without your assistance.”

●“I feel we have much to give to each other — you in the scientific field and me as one who is working with those beautiful, highly evolved Beings living on the planets, stars, orbs in our many universes. . . . ”

●“Behind Jupiter hidden from earth, is a small planet and for the want of a name, let us call it, JUPITENOUS. It is on this planet that these UFO’s come from. . . . ”

One woman wrote him in the fall of 1996 to discuss people who communicated from beyond the grave. Sagan wrote back:

“The only thing that would convince me, coming over from ‘the other side’, is information that we do not yet have but that once enunciated would be verifiable. Let’s have Sophocles, Democritus, and Aristarchus dictate their lost works. Let’s ask Fermat to reproduce his short proof of Fermat’s Last Theorem. Have Alexander the Great tell us where his tomb is so we can go dig and verify.”

In the papers, we see Sagan imagining life not only on Venus and Mars but even beneath the surface of the moon. That’s the young Sagan, fresh out of the University of Chicago.

We also see the mature Sagan pondering the tendentious issues of God and the relationship of science and religion.

In a 1989 letter to famed Harvard scientist Stephen Jay Gould, he refers to a Cincinnati Post editorial:

“Do you understand how — assuming either of us ever did say ‘The universe can be explained without postulating God’ — this could be understood as dogmatic? I often talk about the ‘God hypothesis’ as something I’d be fully willing to accept if there were compelling evidence; unfortunately, there is nothing approaching compelling evidence. That attitude, it seems to me, is undogmatic.”

In October 1996, Sagan wrote to Robert Pope of Windsor, Ontario:

“I am not an atheist. An atheist is someone who has compelling evidence that there is no Judeo-Christian-Islamic God. I am not that wise, but neither do I consider there to be anything approaching adequate evidence for such a god. Why are you in such a hurry to make up your mind? Why not simply wait until there is compelling evidence?”

He died two months later. Soon after, Gould wrote to Sagan’s widow:

“He taught the whole world. What a wonderful life!”