Most liquid detergents are basic, with a pH ranging from 8 to 11. This is because the surfactants that are used to make liquid detergents are typically alkaline. Surfactants are molecules that have both hydrophilic (water-loving) and hydrophobic (water-hating) ends. When surfactants are dissolved in water, they form micelles, which are spherical structures with the hydrophilic ends facing outward and the hydrophobic ends facing inward. Micelles can trap dirt and oil molecules, which allows them to be removed from surfaces.
The basicity of liquid detergents can also help to remove stains. Stains are typically acidic, so the basic detergent can help to neutralize the acids and break down the stain molecules.
It is important to note that some liquid detergents may be acidic, especially those that are designed for use on delicate fabrics. It is always best to test a detergent on a small area of fabric before using it on the entire garment.