A difference between soap and detergent? Though both clean what they are designed to clean, they possess a different chemistry and functionality.
Soap is defined as a metallic salt of a fatty acid—the metal often being an alkali metal such sodium or potassium, or an alkaline earth metal, such as calcium or magnesium. A fatty acid is often of plant or animal origin, and contains an aliphatic or straight chain carbon skeleton, with a carboxylic acid group at its end.
Detergents, on the other hand, are generally of synthetic origin. They’re generally not made insoluble by mineralized—so-called hard—water. Instead of a carboxylic acid group, the detergent may contain a sulfate or sulfonate group. In addition, detergents can contain an aromatic ring or rings. Detergents possess additional properties—and may serve as surfactants and foaming agents.
An example of a soap is sodium palmitate: CH₃(CH₂)₁₄-COO⁻ Na⁺
An example of a detergent is sodium lauryl sulfate: CH₃(CH₂)₁₂-OS(O)₂-O⁻ Na⁺