Soap
Soap is a surfactant used in conjunction with water for washing and cleaning that is available in solid bars and in the form of a viscous liquid.
Chemically, soap is a salt of a fatty acid. Traditionally, soap is made by the reaction between a fat and a strong alkali such as lye (sodium hydroxide), potash (potassium hydroxide), or soda ash (sodium carbonate). Historically, the alkali was leached from hardwood ashes.
The chemical reaction that yields soap is known as saponification. In the saponification of a fat to form soap the alkali and water hydrolyze the fat thus converting it into free glycerol/glycerin and soap (fatty acid salt).  Occasionally, saponification can occur naturally: an underground mass tomb in Sicily has corpses whose bodies are slowly becoming saponified.
Many cleaning agents today are technically not soaps, but detergents, which are less expensive and easier to manufacture.
In some countries, its compulsory to indicate the Total Fatty Matter (TFM) content of soap that is sold to consumers, as a percentage. Usually it averages around 70%.

# How soap works
Soaps are useful for cleaning because soap molecules attach readily to both nonpolar molecules (such as grease or oil) and polar molecules (such as water). Although grease will normally adhere to skin or clothing, the soap molecules can attach to it as a "handle" and make it easier to rinse away. Applied to a soiled surface, soapy water effectively holds particles in suspension so the whole of it can be rinsed off with clean water.
(fatty end)  :CH3-(CH2)n-CO2-   +Na:  (water soluble end)
The hydrocarbon ("fatty") portion dissolves dirt and oils, while the ionic end makes it soluble in water. Therefore, it allows water to remove normally-insoluble matter by emulsification.

# Soap making
The most common soap making process today is the cold process method, where fats such as rendered lard react with lye. Some soapers also practice other processes, such as the historical hot process, and make special soaps such as clear or transparent soap, which must be made with ethanol or isopropyl alcohol.
Soap makers sometimes use the melt and pour process, where a premade soap base is melted and poured in individual molds. While some people think that this is not really soap making, the Hand Crafted Soap Makers Guild does recognize this as a legitimate form of soap crafting.
Handmade soap differs from industrial soap in that whole oils containing intact triglycerides are used and glycerin is a desirable byproduct. Industrial detergent manufacturers commonly use fatty acids, which are detached from the gylcerol heads found in triglycerides. Without the glycerol heads, the detached fatty acids do not yield glycerin as a byproduct.

## Lye
Reacting fat with lye (sodium hydroxide) will produce a hard bar soap. Reacting fat with potassium hydroxide will produce a soap that is either soft or liquid. Historically, the alkalis used were sodium hydroxide, potassium hydroxide, and sodium carbonate leeched from hardwood ashes.

## Fat
Soap is made from either vegetable or animal fats. Sodium tallowate, a fatty acid sometimes used to make soaps, is derived from tallow, which is rendered from cattle or sheep tissue. Soap can also be made of vegetable oils, such as palm oil, olive oil, or coconut oil. If soap is made from pure olive oil it may be called Castile soap or Marseille soap. Castile is also sometimes applied to soaps with a mix of oils, but a high percentage of olive oil.
An array of oils and butters are used in the process such as olive oil, coconut oil, palm oil, cocoa butter, hemp oil and shea butter to provide different qualities. For example, olive oil provides mildness in soap; coconut oil provides lots of lather; while coconut and palm oils provide hardness. Most common, is a combination of coconut, palm, and olive oils.

## Process
Cold process soap making is done without heating the soap batter, while hot process soap making requires that the soap batter be heated. Both processes are further described after the general soap making process description.

### General soap making process
Soap making requires the use of saponification charts to determine the correct lye/fat ratio. If excess unreacted lye remains in the soap, the resultant high pH can burn or irritate skin.
Conversely, a high proportion of excess fat will result in greasy sludge that will not form solid bars of soap, although some soap makers deliberately "superfat" their soap so that some oils will remain in the finished bars of soap. This can be done by either adding a small (5-10%) excess proportion of fats, or by discounting the formulated amount of lye to 90-95%.
The lye is dissolved in water; as this is an exothermic process, the solution will spontaneously generate heat and may even boil. The oils are heated separately (to the point of liquefaction if they are solid at room temperature). Once fats and lye water have both cooled to 80-100F (27-38C), they are combined. This mixture of lye water and fats is stirred until "trace" occurs and the mixture becomes a soap batter. There are varying levels of trace: a light trace implies a thinner soap batter and a heavy trace implies a thicker soap batter. Additives, such as essential oils, fragrance oils, botanicals, clays, colorants or other fragrance materials, are combined with the soap batter at different degrees of trace, depending upon the additive.  With elapsed time and continued agitation the soap batter will continue to thicken. The cold process soap batter is then poured into molds, while hot process soap batter is poured into a double boiler or crockpot to sustain a high temperature.

### Cold-process
Although cold-process soapmaking takes place at room temperature, the fats are first heated to ensure the liquification of the fats used. Then, when the lye water solution is added to the fats, it should be the same temperature of the melted oils and both are typically between 80-90F. An external heat source is not necessary but the molded soap should be incubated by being wrapped in blankets or towels for 24 hours after being poured into the mold. Milk soaps are the exception and do not require insulation, which may cause the milk to sour. The soap will continue to exothermically give off heat for many hours after being molded. During this time, it is normal for the soap to go through a "gel phase" where the opaque soap will turn semi-transparent for several hours before turning opaque again. The soap may be removed from the mold after 24 hours but the saponification process takes several weeks to complete.

### Hot-process
Unlike cold processed soap, all hot processed soap experiences a "gel phase" as a result of being heated, such as in a double boiler or crockpot. Hot process soap may be used soon after being removed from the mold because the higher temperatures accelerate the saponifcation process and also drive off excess water.

## Purification and finishing
The common process of purifying soap involves removal of sodium chloride, sodium hydroxide, and glycerol. These components are removed by boiling the crude soap curds in water and re-precipitating the soap with salt.
Most of the water is then removed from the soap. This was traditionally done on a chill roll which produced the soap flakes commonly used in the 1940s and 1950s. This process was superseded by spray dryers and then by vacuum dryers.
The dry soap (approximately 6-12% moisture) is then compacted into small pellets. These pellets are now ready for soap finishing, the process of converting raw soap pellets into a salable product, usually bars.
Soap pellets are combined with fragrances and other materials and blended to homogeneity in an amalgamator (mixer). The mass is then discharged from the mixer into a refiner which, by means of an auger, forces the soap through a fine wire screen. From the refiner the soap passes over a roller mill (French milling or hard milling) in a manner similar to calendering paper or plastic or to making chocolate liquor. The soap is then passed through one or more additional refiners to further plasticize the soap mass. Immediately before extrusion it passes through a vacuum chamber to remove any entrapped air. It is then extruded into a long log or blank, cut to convenient lengths, passed through a metal detector and then stamped into shape in refrigerated tools. The pressed bars are packaged in many ways.
Sand or pumice may be added to produce a scouring soap. This process is most common in creating soaps used for human hygiene. The scouring agents serve to remove dead skin cells from the surface being cleaned. This process is called exfoliation. Many newer materials are used for exfoliating soaps which are effective but do not have the sharp edges and poor size distribution of pumice.

# History

## Early history
The earliest recorded evidence of the production of soap-like materials dates back to around 2800 BC in Ancient Babylon. A formula for soap consisting of water, alkali and cassia oil was written on a Babylonian clay tablet around 2200 BC.
The Ebers papyrus (Egypt, 1550 BC) indicates that ancient Egyptians bathed regularly and combined animal and vegetable oils with alkaline salts to create a soap-like substance. Egyptian documents mention that a soap-like substance was used in the preparation of wool for weaving.

## Roman history
It had been reported that a factory producing soap-like substances was found in the ruins of Pompeii (AD 79). However, this has proven to be a misinterpretation of the survival of some soapy mineral substance, probably soapstone at the Fullonica where it was used for dressing recently cleansed textiles. Unfortunately this error has been repeated widely and can be found in otherwise reputable texts on soap history.  The ancient Romans were generally ignorant of soap's detergent properties, and made use of the strigil to scrape dirt and sweat from the body. The word "soap" (Latin sapo) appears first in a European language in Pliny the Elder's Historia Naturalis, which discusses the manufacture of soap from tallow and ashes, but the only use he mentions for it is as a pomade for hair; he mentions rather disapprovingly that among the Gauls and Germans men are likelier to use it than women.
A story encountered in some places claims that soap takes its name from a supposed "Mount Sapo" where ancient Romans sacrificed animals.  Rain would send a mix of animal tallow and wood ash down the mountain and into the clay soil on the banks of the Tiber. Eventually, women noticed that it was easier to clean clothes with this "soap".  The location of Mount Sapo is unknown, as is the source of the "ancient Roman legend" to which this tale is typically credited.  In fact, the Latin word sapo simply means "soap"; it was borrowed from a Celtic or Germanic language, and is cognate with Latin sebum, "tallow"
, which appears in Pliny the Elder's account.  Roman animal sacrifices usually burned only the bones and inedible entrails of the sacrificed animals; edible meat and fat from the sacrifices were taken by the humans rather than the gods.  Animal sacrifices in the ancient world would not have included enough fat to make much soap.  The legend about Mount Sapo is probably apocryphal.

## Muslim history
True soaps made from vegetable oils (such as olive oil), aromatic oils (such as thyme oil) and lye (al-Soda al-Kawia) were first produced by Muslim chemists in the medieval Islamic world. The formula for soap used since then hasn't changed (Nabulsi soap). From the beginning of the 7th century, soap was produced in Nablus (West Bank), Kufa (Iraq) and Basra (Iraq). Soaps, as we know them today, are descendants of historical Arabian Soaps. Arabian Soap was perfumed and colored, some of the soaps were liquid and others were solid. They also had special soap for shaving. It was sold for 3 Dirhams (0.3 Dinars) a piece in 981 AD. The Persian chemist Al-Razi wrote a manuscript on recipes for true soap. A recently discovered manuscript from the 13th century details more recipes for soap making; e.g. take some sesame oil, a sprinkle of potash, alkali and some lime, mix them all together and boil. When cooked, they are poured into molds and left to set, leaving hard soap.
In semi-modern times soap was made by mixing animal fats with lye. Because of the caustic lye, this was a dangerous procedure (perhaps more dangerous than any present-day home activities) which could result in serious chemical burns or even blindness. Before commercially-produced lye (sodium hydroxide) was commonplace, lye (sodium hydroxide), potash (potassium hydroxide), and soda ash (sodium carbonate) were leached from the ashes of a hardwood fire for soap-making at home.

## Modern history
Castile soap was later produced in Europe from the 16th century.
In modern times, the use of soap has become universal in industrialized nations due to a better understanding of the role of hygiene in reducing the population size of pathogenic microorganisms. Manufactured bar soaps first became available in the late nineteenth century, and advertising campaigns in Europe and the United States helped to increase popular awareness of the relationship between cleanliness and health.
Soap has also been used to punish people for cursing or occasionally, for other infractions. This is done by forcibly placing soap into a person's mouth and, sometimes, forcing them to swallow it.  It is commonly known as "washing one's mouth out with soap" or any of numerous variations of that phrase, or, more recently, "mouthsoaping".

## Commercial soap production
Until the Industrial Revolution, soap making was done on a small scale and the product was rough. Andrew Pears started making a high-quality, transparent soap in 1789 in London. With his grandson, Francis Pears, they opened a factory in Isleworth in 1862. William Gossage produced low-price good quality soap from the 1850s. Robert Spear Hudson began manufacturing a soap powder in 1837, initially by grinding the soap with a mortar and pestle. William Hesketh Lever and his brother, James, bought a small soap works in Warrington in 1885 and founded what is still one of the largest soap businesses, now called Unilever. These soap businesses were among the first to employ large scale advertising campaigns.
In the United States, one of the first manufacturers of soap was the Armour and Company in Chicago in 1888.  The soap was made from tallow, a by-product of the meat production process.  In 1948, Armour soap became Dial soap, the first deodorant or antibacterial soap introduced in the USA.