Excerpted from Toms River: A Story of Science and Salvation, by Dan Fagin. Copyright © March 19, 2013, Bantam Books.

The very big idea that would transform Toms River and reshape the global economy was born in 1856 in the attic laboratory of a precocious eighteen-year-old chemistry student named William Henry Perkin, who lived with his family in London’s East End. It was Easter vacation, and Perkin was using the time off to work on some coal tar experiments suggested by his mentor at the Royal College of Chemistry, August Wilhelm von Hofmann.

No one in the world knew more about the chemical properties of coal tar than Hofmann, and coal tar was a very important compound to know about. It was, arguably, the first large-scale industrial waste. By the mid-1800s, coal gas and solid coke had replaced candles, animal oils, and wood as the most important sources of light, heat, and cooking fuel in many European and American cities. Both coal gas and coke were derived from burning coal at high temperatures in the absence of oxygen, a process that left behind a thick, smelly brown liquid that was called coal tar because it resembled the pine tar used to waterproof wooden ships. But undistilled coal tar was not a very good sealant and was noxious, too, and thus very difficult to get rid of. Burning it produced hazardous black smoke, and burying it killed any nearby vegetation. The two most common disposal practices for coal tar, dumping it into open pits or waterways, were obviously unsavory. But Hofmann, a Hessian expatriate who was an endlessly patient experimenter, was convinced that coal tar could be turned into something useful. He had already established a track record of doing so at the Royal College of Chemistry, where he was the founding director. Knowing that the various components of coal tar vaporized at different temperatures as it was heated, Hofmann spent years separating its many ingredients. In the 1840s, his work had helped to launch the timber “pickling” industry, in which railway ties and telegraph poles were protected from decay by dipping them in creosote, made from coal tar. But the timber picklers were not interested in the lighter and most volatile components of coal tar, which were still nothing but toxic waste—more toxic, in fact, than undistilled coal tar. So Hofmann and his students kept experimenting.

One of those students was young William Perkin. Hofmann had him working on a project that involved breaking down some key components of coal tar to their nitrogen bases, the amines. Hofmann knew that quinine, the only effective treatment for malaria and thus vital to the British Empire, was also an amine, with a chemical structure very similar to that of several coal tar components, including naphtha. He also knew that bark from Peruvian cinchona trees was the only source of quinine, which is why the medicine was costly and very difficult to obtain. But what if the miracle drug could be synthesized from naphtha or some other unwanted ingredient of coal tar? Hofmann did not think it could, but he considered it a suitable project for his promising teenage protégé.

Perkin eagerly accepted the challenge; like his mentor Hofmann, he was an obsessive experimenter. Perkin set to work during his Easter vacation, while Hofmann was in Germany. Laboring in a small, simple lab on the top floor of his family’s home, Perkin decided to experiment with toluene, a toxic component of coal tar that would later play a major role in Toms River. Perkin isolated a derivative called allyl-toluidine, then tried to transform it into quinine by oxidizing it in a mixture with potassium dichromate and sulfuric acid. When he was finished, his test tube contained a reddish-black powder, not the clear medicine he was hoping to see. So Perkin tried again, this time choosing a simpler amine called aniline, which was derived from benzene, another coal tar component that would become notorious later. Once again, he mixed it with potassium dichromate and sulfuric acid, and again the experiment flopped. This time, a black, gooey substance was at the bottom of his test tube, and it certainly was not quinine.

When Perkin washed the black goo out of the test tube, however, he saw something that intrigued him: a bright purple residue on the glass. The color was vivid, and it clung stubbornly to the glass. Even more interestingly, when he treated the gunk with alcohol, its purple color transferred flawlessly to a cotton cloth he used to clean his test tubes. Perkin had stumbled upon the molecular magic of aniline. Benzene, toluene, and other components of coal tar were colorless because they absorbed ultraviolet light undetectable by the human eye. But if those aromatic hydrocarbons were treated with an acid to create aniline or another amine, after some additional steps the newly synthesized molecules very efficiently absorbed light particles from specific wavelengths in the visible spectrum. The young chemist did not know why the resulting color was so vivid; the ability of molecules to absorb photons at specific wavelengths based on the structure of their shared electron bonds would not be worked out for another fifty years. He did not even know exactly what he had created; the precise molecular structure of his new chemical would not be deduced until the 1990s. But Perkin did not need anything more than his own eyes to know that what was at the bottom of his test tube might prove very useful, especially after its color transferred so flawlessly onto the cotton cloth. A few months earlier, Perkin and a fellow student had tried to synthesize a textile dye and failed; now he had somehow succeeded while trying to create a medicine for malaria. As Perkin knew, whoever created the first artificial dye capable of staining silk, cotton, and other fabrics with a beautiful color might get very rich. Perhaps, the teenager thought, his failed experiment might not be a failure after all.

Dyes were a very big business, and always had been. The human impulse to drape our bodies in color is primal; ancient cultures from India to the Americas colored their clothes and skin with dyes extracted from wood, animals, and flowering plants. The most celebrated hue of the ancient world, by far, was Tyrian purple. It could be produced only from the milky mucosal secretions of several species of sea snails, or whelks, especially one in the Eastern Mediterranean known as the spiny dye-murex. The reddish purple dye was prized because it was both dazzling in hue and vanishingly scarce. Each murex typically produced only a few drops of dye—and only when freshly caught. It was a color of legendary origin, supposedly discovered by Heracles (Hercules, to the Romans). According to Greek myth, the great hero saw that his dog’s mouth was stained purple after chewing shells on the Levantine shore. Heracles considered the hue to be so magnificent that he presented a purple robe to the king of Phoenicia, who promptly declared the color to be a symbol of royalty and made Tyre the ancient world’s center of murex dye production. And that is why, on the Ides of March in the year 44 B.C., Julius Caesar was wearing his ceremonial robe of Tyrian purple when he was slain by Brutus in the senate house of Rome. It is also why, thirteen years later at the Battle of Actium, the sails of Cleopatra’s royal barge were dyed vivid purple.

With the decline of the Roman Empire, the elaborate system of murex cultivation and dye production established by the Romans disappeared, and so did the purple hue itself. A millennium of grays, browns, and blacks followed. A new dye industry finally arose in the late Middle Ages, allowing Catholic cardinals to cloak themselves in scarlet drawn from the shells of tiny kermes insects and tapestry makers to weave with vivid reds from dyewood trees native to India and Brazil. There were purples, too, mostly from lichens, but they were pale and faded quickly. The deep reddish purple of Caesar and Heracles, hue of power and wealth, monarch of colors, was no longer in the dye maker’s palette. It was gone, sustained only in legend.

And then, suddenly, there it was, clinging tenaciously to the glass walls of eighteen-year-old William Henry Perkin’s test tubes, without a sea snail in sight. Within six months, Perkin had patented his dye-making process and resigned from the Royal College of Chemistry (over the objections of his mentor, Hofmann, who thought he was being reckless) to devote himself to the manufacture of the dye he first called Tyrian purple. He later switched to an appellation that would go down in history as the first commercial product of the synthetic chemical industry: Perkin’s mauve, or mauveine. At first, Perkin and his brother, Thomas, made their dye in William’s top-floor workshop. Then they switched to the garden behind the family home, and finally to a factory on the outskirts of London alongside the Grand Junction Canal. Luckily for the Perkin brothers, light purple happened to be très chic in the salons of Paris and London in 1857 and 1858. Mauve, as the French called it, was the favorite hue of both Empress Eugénie of France and her close friend Queen Victoria of England. Perkin’s new dye was not only brighter than the mauves his French competitors laboriously produced from lichen, it was also much cheaper. Thanks to Perkin, any fashionable woman could afford to wear Eugénie’s favorite color, and by 1858 almost all of them did. The dye houses of Europe took notice, creating their own crash research programs in aniline chemistry and sending delegations to London to negotiate access to Perkin’s manufacturing secrets.

Two rival dye makers from Basel, Switzerland, were among the closest observers of Perkin’s success. Johann Rudolf Geigy-Merian was among the fourth generation of Geigys in the dyewood business in Basel; his great-grandfather Johann Rudolf Geigy-Gemuseus had founded the firm one hundred years earlier in 1758. His competitor

Alexander Clavel was a relative newcomer to Basel and was not even Swiss. Clavel was a Frenchman who resettled in Basel because that city, situated strategically on the Rhine River between Germany and France, was a thriving center of the textile trade. Geigy-Merian and Clavel shared a fascination with Perkin’s breakthrough in aniline chemistry and the cheaper, brighter dyes it produced. Their enthusiasm quickened with the discovery, in 1858, of the second great aniline dye. It was a bright red called fuchsine that could be produced even more cheaply than Perkin’s mauveine.

To Geigy and Clavel, there seemed to be no reason not to try to out-Perkin Perkin, especially because the young Englishman had failed to secure patents in any countries except his own. Even if he had, it would not have mattered, since Switzerland did not enforce patents and would not recognize any chemical process as protectable intellectual property for another fifty years. (The resentful French called Switzerland le pays de contre-facteurs, the land of counterfeiters, while the even angrier Germans called it der Räuber-Staat, the nation of pirates.) Geigy and Clavel did not bother trying to negotiate with Perkin; he had discussed his methods with enough people that they were now effectively in the public domain—in patent-free Switzerland, at least. By the end of 1859, Geigy and Clavel had each established his own thriving aniline dye manufacturing operation in Basel, within a few miles of each other on canals near the Rhine. In doing so, they set their firms on course to become two of the largest chemical manufacturers in the world—and eventual partners in a sprawling manufacturing operation in a small New Jersey town that had its own history of piracy: Toms River.

Over the next ten years of frenetic activity along the Rhine, in Germany as well as Switzerland, the production of aniline dyes—purples, reds, and blacks first, then every color in the rainbow—transformed one small family firm after another into international colossi. By 1870, thanks to the new synthetic dyes, most of the companies that would dominate the chemical industry for the next century and a half had established themselves as global players. The list included Geigy, Bayer, Hoechst, Agfa (an acronym for Aktiengesellschaft für Anilinfabrikation, or the Corporation for Aniline Production), and the biggest of all, BASF, which stood for Badische Anilin-und Soda-Fabrik, or the Baden Aniline and Soda Factory. Alexander Clavel’s company prospered, too, especially after he sold it in 1873. Eleven years later, the company took the name Gesellschaft für Chemische Industrie im Basel, Society for Chemical Industry in Basel, or Ciba for short. The third great Basel dye maker, Sandoz, jumped into the game soon afterward, in 1886.

The companies’ success began with the appropriation of Perkin’s big idea, but it did not end there. An even more important decision was to follow the instinct of his mentor, Hofmann, by pulling apart coal tar and finding uses for all of its constituent parts, not just aniline. After the aniline dyes, derived from benzene, came magentas made from toluene, reds from anthracene, pinks from phenol, and indigos from naphthalene. These were all hydrocarbons, the abundant and inexpensive building blocks of organic chemistry. Hydrocarbons proved extremely useful to the new world of chemical fabrication for the same reason that hydrogen and carbon are vital to the chemistry of life. When atoms of hydrogen and carbon form molecules, they tend to arrange themselves into durable structures of rings and long chains in which the atoms bond strongly via shared electrons. About four billion years ago, the strength of those hydrogen-carbon bonds allowed increasingly complex molecules—amino acids, DNA, and proteins—to form from the primordial soup, making life possible. Now, upon the stable platform of the hydrocarbon polymers in coal tar, chemists began to build a galaxy of new materials that were stronger, more attractive, and cheaper than what nature provided.

Dyes came first, soon followed by paints, solvents, aspirin, sweeteners, laxatives, detergents, inks, anesthetics, cosmetics, adhesives, photographic materials, roofing, resins, and the first primitive plastics—all synthetic and all derived from coal tar, the fountainhead of commercial chemistry. (Coal tar shampoos and soaps came too—and are still available in very diluted form as approved treatments for psoriasis and head lice.) Germany’s Ruhr Valley, with its vast deposits of bituminous coal, became the industrial heartland of Europe and thus the world. The British satirical magazine Punch, which back in 1859 had lampooned “mauve measles” as a fashion epidemic that should be treated with a “dose of ridicule,” by 1888 was singing the praises of aniline chemistry, with only a tinge of sarcasm:

Beautiful Tar, the outcome bright
Of the black coal and the yellow gas-light,
Of modern products most wondrous far,
Tar of the gas-works, beautiful Tar! . . .

Oil, and ointment, and wax, and wine,
And the lovely colours called aniline;
You can make anything from a salve to a star,
If you only know how to, from black Coal-tar.

When the chemical manufacturers finally did expand beyond coal tar chemistry at the end of the nineteenth century, they did so by adapting their manufacturing protocols to petroleum and other raw materials, thereby producing an even larger array of tremendously successful products, from acetone to X-ray plates. Ciba even acquired its own shale oil deposits in the Alps as a new feedstock. By the time the three huge Basel-based chemical makers (Ciba, Geigy, and Sandoz) had formed an alliance to make dyes and other products in the United States—first in Cincinnati, Ohio, in 1920 and then in Toms River in 1952—the industry had proved itself capable of synthesizing almost any natural material.

It was a phenomenally profitable business—as long as no one paid too much attention to what the manufacturing process left behind.

Excerpted from Toms River: A Story of Science and Salvation, by Dan Fagin. Copyright © March 19, 2013, Bantam Books.