Soap is known to have been used as a surfactant for washing clothes since the Sumerian time in 2,500 B.C. In ancient Egypt, soda was used as a wash additive. In the 19th century, synthetic surfactants began to be created, for example from olive oil. Sodium silicate (water glass) was used in soap-making in the United States in the 1860s, and in 1876, Henkel sold a sodium silicate-based product that can be used with soap and marketed as a "universal detergent" (Universalwaschmittel) in Germany. Soda was then mixed with sodium silicate to produce Germanys first brand name detergent Bleichsoda. In 1907, Henkel also added a bleaching agent sodium perborate to launch the first self-acting' laundry detergent Persil to eliminate the laborious rubbing of laundry by hand.
During the First World War, there was a shortage of oils and fats needed to make soap. In order find alternatives for soap, synthetic detergents were made in Germany by chemists using raw material derived from coal tar. These early products, however, did not provide sufficient detergency. In 1928, effective detergent was made through the sulfation of fatty alcohol, but large-scale production was not feasible until low-cost fatty alcohols become available in the early 1930s. The synthetic detergent created was more effective and less likely to form scum than soap in hard water, and can also eliminate acid and alkaline reactions and decompose dirt. Commercial detergent products with fatty alcohol sulphates began to be sold, initially in 1932 in Germany by Henkel. In the United States, detergents were sold in 1933 by Procter & Gamble (Dreft) primarily in areas with hard water. However, sales in the US grew slowly until the introduction of built detergents with the addition of effective phosphate builder developed in the early 1940s. The builder improves the performance of the surfactants by softening the water through the chelation of calcium and magnesium ions, helping to maintain an alkaline pH, as well as dispersing and keeping the soiling particles in solution. The development of the petrochemical industry after the Second World War also yielded material for the production of a range of synthetic surfactants, and alkylbenzene sulfonates became the most important detergent surfactants used. By the 1950s, laundry detergents had become widespread, and largely replaced soap for cleaning clothes in developed countries.
Over the years, many types of detergents have been developed for a variety of purposes, for example, low-sudsing detergents for use in front-loading washing machines, heavy-duty detergents effective in removing grease and dirt, all-purpose detergents and specialty detergents. They become incorporated in various products outside of laundry use, for example in dishwasher detergents, shampoo, toothpaste, industrial cleaners, and in lubricants and fuels to reduce or prevent the formation of sludge or deposits. The formulation of detergent products may include bleach, fragrances, dyes and other additives. The use of phosphates in detergent, however, led to concerns over nutrient pollution and demand for changes to the formulation of the detergents. Concerns were also raised over the use of surfactants such as branched alkylbenzene sulfonate (tetrapropylenebenzene sulfonate) that lingers in the environment, which led to their replacement by surfactants that are more biodegradable, such as linear alkylbenzene sulfonate. Developments over the years have included the use of enzymes, substitutes for phosphates such as zeolite A and NTA, TAED as bleach activator, sugar-based surfactants which are biodegradable and milder to skin, and other green friendly products, as well as changes to the form of delivery such as tablets, gels and pods.