Soap and detergent use surfactants to help remove dirt from clothes. Surfactants contain both water-soluble and water-insoluble parts that allow them to attach to dirt and water molecules, loosening dirt from fabrics. Soap is made from fat and oil mixed with alkalis like sodium hydroxide, while detergent contains synthetic petrochemical surfactants that work better in hard water by preventing dirt from redepositing. Both soap and detergent rely on chemical, thermal, and mechanical energy sources to clean clothes through the actions of their surfactants and added enzymes.