The compound in lye, sodium hydroxide, is among the most easily-accessible corrosive chemicals— a wide range of products ranging from Drano to specialty batteries contain it, despite it being the sort of substance that will happily make short work of your fingertips if you are not careful.
The reason the sodium hydroxide is so unreasonably caustic is not because it is acidic, but rather because it is so anti-acidic, or basic. While acids do have their fair share of malevolent uses—most notably to melt Coke cans—they only represent half of the story. Acids corrode things like metal because they love to toss protons at things they encounter, allowing them to provoke strange reactions in a wide variety of compounds. But bases are guilty of just the opposite; they steal protons from anything they come in contact with. Different materials will be more susceptible to acids or bases depending on their properties: while a metal might readily dissolve when exposed to an acid(usually because the acid’s protons encourage the metal to oxidize extra quickly), it might remain relatively inert when a base is applied to it. Likewise, organic compounds like cellular membranes are particularly susceptible to bases, making bases the reagents of choice for products like drain cleaner, which are used to break up the greasy globs of proteins that inhabit your kitchen sink after dinner. The susceptibility of organic tissue to bases is part of the reason why bases can be so dangerous.
As demonstrated by the familiar vinegar and baking soda volcanoes that annually discolor the floors of school gymnasiums nationwide, reactions between acids and bases are particularly vigorous. This makes sense, since one reagent is eager to steal a proton and another is eager to relinquish one. The products of acid/base reactions tend to be inert gases and water, making them extremely useful in bodily metabolic processes like digesting food.
A chemistry teacher once told me that half of all chemistry is simply keeping track of electrical charges. Acid/base reactions certainly seem to fall in this half. Thus it would seem natural that there are certain types of reactions that will only occur in the presence of an electric field, as not all compounds have the proclivity to exchange protons and electrons as acids and bases. Electrolysis reactions represent those charge exchanges that will not occur spontaneously unless abetted by an external electric field. These reactions generally only occur between metals within a conducting solution(like saltwater), because metals and ionic solutions are generally the best at conducting the DC currents necessary to sustain such reactions. Electrolysis and its variants are used in industry to plate metals with other metals, to etch designs without the need for a laser, and occasionally to isolate pure elements that tend to not exist in pure forms in nature—because the electric field puts so much energy into the reaction vessel, it allows otherwise unstable elements to be isolated.
The latter usage is quite beneficial to the home chemist—there are many great tutorials out there for making pure hydrogen and oxygen gases by running a battery through salt water. The reason I mention this usage of electrolysis in the context of acid base chemistry is because, one fine day in high school, I decided that it would be a prudent idea to heat sodium hydroxide to its melting point and then perform electrolysis with a high-current power supply. I wanted to isolate pure sodium metal, which has a variety of useful properties, and for this reason I was oblivious to the risks of running high power electrical current through boiling hot caustic lye. Here is the result, complete with Hollywood production values:
Here is what was supposed to happen: By running a cheap tube from a cooler filled with dry ice, I could pipe cold carbon dioxide into the melting crucible and displace any oxygen inside the chamber. This would supposedly suppress any fires from starting and keep side reactions in check. Supposedly, if I had done this perfectly, the molten sodium hydroxide would have reacted happily with the DC current and liberated a small amount of molten elemental sodium at one of the electrodes, which would have formed a shiny metallic pool at the top of the molten base.
Sadly, I seem to have undervalued the awesome power of bases. The molten sodium hydroxide will react with almost anything it can find, and so it begins to react with the metal sides of my melting vessel to yield samples of an intricate group of molecules known as “complex ions.” These are the sickening black substances that accrue inside my crucible—the molten sodium hydroxide normally should have remained transparent. The carbon dioxide seems to have done its job, as I still have all of my fingers, but the reaction nonetheless failed to yield an appreciable amount of sodium due to the complex ions’ interloping.
You can hear some sodium metal hissing as I drop the cathode into the pool of water at the end of the video, leading me to believe that a small amount of sodium was indeed liberated (and yes, I did wait for the cathode to cool before I dropped it in). The hissing is the sound of the elemental sodium aggressively recombining with water to form sodium hydroxide and hydrogen gas, the latter of which loudly deflagrates due to the heat of the reaction.