The detergent is a surfactant or a mixture of surfactants with cleaning properties in diluted solutions. These substances are usually alkylbenzene sulfonates, a family of compounds that are similar to soap, but are more soluble in hard water, because the polar sulfonate (of detergents) is less likely, than the polar carboxylate (of soap), to bind to calcium and other ions found in hard water.
In most household contexts, the term detergent itself refers specifically to laundry detergent or dish detergent, as opposed to hand soap or other types of detergents. They are usually available in the form of powders or concentrated solutions. Detergents, like soaps, work because they are partially hydrophilic (polar) and partially hydrophobic (non-polar) amphiphiles. Their dual nature facilitates the mixing of hydrophobic compounds (such as oil and fat) with water. Because the air is not hydrophilic, detergents are also foaming agents to varying degrees.