← Back to Chemistry Chemistry Health

How to Make Shampoo at Home (With Calculator), According to Science

Glass pump bottle of pale homemade shampoo on a bathroom shelf beside a folded towel and a wooden comb

Short answer: stir 34 g of decyl glucoside and 38 g of cocamidopropyl betaine into 155 g of distilled water, add glycerin, a pinch of xanthan gum and a cosmetic preservative, then bring the pH down to about 5 with citric acid. That makes 8 fl oz (240 mL) of mild, sulfate-free shampoo in 20 minutes. Castile soap and baking soda recipes skip the pH step, and that is why they leave hair dull and tangled.

I make shampoo the way a cosmetic chemist would: by weight, with a pH strip in hand. Hair is a protein fiber with an electric charge, and the pH of the wash decides how rough that charge makes it. This guide gives three recipes, a calculator that scales them to your bottle and hair type, and the chemistry behind each step.

At a glance

  • Time20 minutes
  • Makes8 fl oz, about 33 washes
  • DifficultyEasy, with a scale
  • CostBelow salon shampoo per wash

What you need

  • 155 g distilled water
  • 34 g decyl glucoside
  • 38 g cocamidopropyl betaine
  • 5 g glycerin and 1 g xanthan gum
  • 2.4 g cosmetic preservative, citric acid and pH strips

Steps

  1. Mix the xanthan gum into the glycerin.
  2. Stir the slurry into the water until it thickens.
  3. Stir in both surfactants slowly, without foaming.
  4. Add the preservative.
  5. Add citric acid by drops until the pH reads 5.

The one tool that matters

Measure by weight, not by spoon. Surfactants are thick and cling to measuring spoons, and a kitchen scale that reads 0.1 g makes the recipe repeatable. The calculator gives spoon measures only as a rough check.

This guide contains Amazon affiliate links. 33Science earns a commission on qualifying purchases. See our affiliate disclosure.

Homemade shampoo calculator

Choose a formula, a bottle size, your hair type and a preservative. The calculator lists every ingredient as a percentage and a weight, estimates the citric acid you will need and tells you how long the bottle lasts.

Homemade shampoo calculator

Pick a formula, a bottle size and your hair type. The calculator gives every ingredient by weight, the citric acid to start with, and how long the bottle lasts.

Weights assume decyl glucoside at 50% active, cocamidopropyl betaine at 30%, SLES liquid at 28% and a dose of about 7 g (1½ teaspoons) per wash. US measures are approximate; weigh on a scale that reads 0.1 g. The citric acid figure is a starting point: always finish by testing the pH.

To size a citric acid adjustment for a different batch, use the pH adjustment calculator.

Hair type sets the strength. An oily scalp gets 15% active surfactant, normal hair 12% and dry, curly or color-treated hair 9%. Less surfactant removes less of the sebum that keeps dry hair supple. The glucoside and betaine split stays fixed at 60:40 by active matter, a ratio that cleans well while staying mild.

Ingredients and tools

Shampoo-making setup on a kitchen counter: digital scale with a glass beaker, bottles of liquid surfactants and glycerin, xanthan gum, citric acid, a dropper bottle, pH strips and an empty pump bottle
Everything for the sulfate-free recipe. The scale and the pH strips do more for the result than any ingredient.

Decyl glucoside

Nonionic surfactant from corn sugar and coconut alcohol

14% of the batch

The main cleaner. Sold as a 50% solution. Its pH out of the bottle is around 12, so the batch needs acid.

Cocamidopropyl betaine

Amphoteric surfactant from coconut oil

16% of the batch

Builds foam and makes the anionic or nonionic cleaner gentler on skin and eyes. Sold as a 30% solution.

Glycerin

Glycerol, C3H8O3

2%

A humectant that holds water on the hair and scalp. It also carries the xanthan gum so it disperses without lumps.

Xanthan gum

Polysaccharide from fermentation

0.4%

Thickens glucoside shampoos, which salt does not thicken. Too much makes the shampoo stringy.

Citric acid

C6H8O7

About 0.6%, to pH 5

Brings the pH down into the range hair tolerates. Dissolve it in an equal weight of water first.

Cosmetic preservative

For example benzyl alcohol, salicylic acid, sorbic acid

1%

Required in any water-based shampoo you keep longer than a week. Choose one rated for rinse-off products and for your final pH.

Active matter

Each surfactant is sold diluted in water. A label of “30% active” means 100 g of the bottle carries 30 g of surfactant. Recipes that list the bottle weight without the active content cannot be compared; the calculator works in active matter and converts back to bottle weight.

Tools

  • A digital scale that reads 0.1 g for the small ingredients
  • pH test strips with a 4 to 7 range or a pH meter
  • A glass beaker or heatproof jug, a silicone spatula and a small dropper bottle
  • Nitrile gloves and glasses for handling concentrated surfactants
  • A clean pump or squeeze bottle, rinsed with boiling water and dried

How to make sulfate-free shampoo

These amounts make 8 fl oz (240 mL) for normal hair. Use the calculator for other sizes and hair types. Work at room temperature; nothing in this recipe needs heat.

Gloved hands pouring thick clear surfactant into a beaker of water on a digital kitchen scale
Surfactant goes into the water, slowly, down the side of the beaker. Poured fast, it whips into foam.
  1. Make the gum slurry. In a small cup, stir 1 g (about ¼ teaspoon) of xanthan gum into 5 g of glycerin until smooth. The glycerin wets each grain so it does not clump when it meets water.
  2. Thicken the water. Weigh 155 g of distilled water into a beaker. Stir in the slurry and keep stirring for two minutes. It turns slightly syrupy as the gum hydrates.
  3. Add the surfactants. Place the beaker on the scale and pour in 34 g of decyl glucoside, then 38 g of cocamidopropyl betaine. Stir slowly with a spatula. A whisk or a fast spoon makes foam that takes hours to settle.
  4. Add the preservative. Stir in 2.4 g of preservative. Check its data sheet for the dose and the pH range it covers.
  5. Adjust the pH. Dissolve 2 g of citric acid in 2 g of warm water. Add it a few drops at a time, stirring and testing, until a strip reads 5. Expect to use most of it, because decyl glucoside is strongly alkaline.
  6. Bottle and label. Pour it into a clean bottle and write the date on it. Let the bubbles rise overnight.

Adjust the thickness

If the shampoo is too thin, stir in another 0.2% of xanthan gum as a glycerin slurry. If it is stringy, you added too much gum; dilute with a little water and a matching share of surfactant.

How to make classic shampoo with SLES

Most drugstore shampoos run on sodium laureth sulfate (SLES) with cocamidopropyl betaine. This version uses the same pair. It foams more than the sulfate-free recipe and thickens with plain salt. For 8 fl oz at 12% active:

  1. Mix the surfactants. Weigh 127 g of distilled water, then slowly stir in 71 g of 28% SLES and 28 g of 30% betaine.
  2. Add glycerin and preservative. Stir in 5 g of glycerin and 2.4 g of preservative.
  3. Set the pH. SLES and betaine sit close to neutral, so only a little citric acid is needed. Add the 50% solution by drops to pH 5 to 5.5.
  4. Thicken with salt. Dissolve 2.4 g of table salt in a spoon of the batch and stir it back in. Wait a minute. Repeat once if you want it thicker, and stop there.

Why salt thickens SLES

Sodium ions crowd the sulfate head groups together, so the spherical micelles grow into long, worm-like chains that tangle and thicken the liquid. Too much salt breaks the worms apart and the shampoo turns thin again. Glucosides have no charged head, which is why salt barely thickens the sulfate-free recipe.

Castile soap shampoo with a vinegar rinse

Castile soap is the most common homemade shampoo online and the most disappointing. It is true soap, with a pH near 9, and in hard water it leaves calcium soap on the hair as a waxy, dull film. It works if you follow every wash with an acid rinse.

  1. Dilute the soap. Mix 2 parts liquid castile soap with 3 parts distilled water in a squeeze bottle. For 8 fl oz: 94 g soap, 137 g water and 5 g glycerin.
  2. Wash. Work 1 to 2 teaspoons into wet hair, mostly at the scalp, and rinse well.
  3. Rinse with acid. Mix apple cider vinegar 1:1 with water, the ratio Dr. Bronner’s recommends, and pour it through the hair. Leave it for a minute, then rinse lightly. Lemon juice works too, at 1 part juice to 2 parts water.

Rinse separately

Never mix vinegar or lemon juice into the soap bottle. Acid turns soap into free fatty acid, an oily layer that separates and stops cleaning. Keep the rinse in a separate cup.

Skip baking soda “no-poo” washes. A baking soda solution has a pH of about 8.3, which swells the cuticle and raises the negative charge on the fiber, and it removes almost no oil because it is not a surfactant.

How to test and adjust the pH

The pH step separates a shampoo from a bottle of diluted detergent. It takes five minutes.

Gloved hand lifting a pH test strip with yellow and orange pads out of a beaker of homemade shampoo, citric acid and a dropper bottle beside it
Strip readings in a thick, foamy liquid are hard to read. Dilute a sample first.
  1. Dilute a sample. Stir 1 teaspoon of shampoo into 9 teaspoons of distilled water. Strips read clearly in the thinner liquid, and a 10% solution is how formulators report shampoo pH.
  2. Dip and compare. Dip a strip for a second, wait 15 seconds and match the color against the chart in good light.
  3. Adjust. Above 5.5, add 5 drops of citric acid solution to the batch, stir for a minute and test again.
  4. Overshot? Below 4.5, add a few drops of a 10% baking soda solution, then test again.
pH readingWhat it meansAction
Above 7Glucoside alkalinity not neutralized, or a soap baseAdd citric acid
5.5 to 7Mild, but raises the charge on hairAdd a few more drops
4.5 to 5.5Target rangeBottle it
Below 4.5Too acidic, may sting eyesAdd a little baking soda solution

The science: how shampoo cleans hair

In three sentences

Shampoo surfactants lift sebum and dirt into micelles that rinse away. Hair is negatively charged above pH 3.7, and an alkaline wash raises that charge, which makes strands repel, rub and frizz. An acidic shampoo keeps the charge low and the cuticle flat.

What shampoo removes

Sebum, the oil from the glands at each hair follicle, is a mix of triglycerides and free fatty acids (about 57%), wax esters (26%), squalene (12%) and smaller amounts of cholesterol. It spreads along the hair shaft, collects dust and styling product, and turns hair limp. Water alone cannot lift it, because these molecules are nonpolar and water molecules hold onto each other through hydrogen bonds.

Surfactants and micelles

A surfactant molecule has a hydrocarbon tail that dissolves in oil and a polar head that dissolves in water. On a greasy hair, the tails sink into the sebum and the heads face the water; rubbing breaks the film into droplets coated with heads. Above the critical micelle concentration, surfactant molecules also cluster into micelles with oily cores. For sodium dodecyl sulfate that threshold is about 8 millimoles per liter. A shampoo at 12% active surfactant is more than a hundred times above it, which is why one teaspoon still cleans after it is diluted in wet hair.

The three surfactant types in these recipes differ by their head group:

TypeExampleHead groupWhat it does
AnionicSLESSulfate, negativeStrong cleaning, big foam, can irritate alone
NonionicDecyl glucosideGlucose, no chargeMild cleaning, gentle, thickens poorly
AmphotericCocamidopropyl betainePositive and negativeBoosts foam, reduces irritation of the others
SoapPotassium oleate (castile)Carboxylate, negativeCleans well, fails in hard water and acid

Betaine makes the mix gentler. Blends richer in betaine score lower on the zein test, a lab measure of how much protein a surfactant pulls out, which tracks skin irritation. Betaine molecules sit between the main surfactant’s molecules in shared micelles and leave fewer free ones to attack the skin.

Why pH matters for hair

Hair is made of keratin, a protein with both acidic (carboxyl) and basic (amino) side groups. At its isoelectric point, measured at about pH 3.7 (published values range from 2.5 to 4.5), the charges balance. Above it the carboxyl groups lose their hydrogen ions and the fiber carries a net negative charge:

Keratin–COOH → Keratin–COO− + H+

The higher the pH, the more negative the surface. Negatively charged strands repel each other, which shows as static and flyaways, and they drag against each other with more friction when you comb, which chips the cuticle scales. A 2014 study in the International Journal of Trichology measured 123 shampoos, found 62% above pH 5.5 and concluded that shampoo pH should not exceed 5.5 for this reason. Alkaline solutions also swell the fiber and lift the cuticle.

The outer lipid layer

The outermost surface of each cuticle cell carries a layer of 18-methyleicosanoic acid (18-MEA), a branched fatty acid bonded to the protein. It makes healthy hair water-repellent and smooth. Alkaline treatments such as bleach, perms and harsh soaps strip it, which is why damaged hair turns porous and tangles. A mild, acidic shampoo removes sebum and leaves this layer in place.

Hard water and soap

Calcium and magnesium ions each carry a charge of +2, so each binds two soap molecules into an insoluble salt:

2 RCOO− + Ca2+ → (RCOO)2Ca

That calcium soap is the waxy coating castile users describe. The vinegar rinse works because acetic acid dissolves it and lowers the pH of the hair surface at the same time. Synthetic surfactants such as SLES and glucosides do not form insoluble calcium salts, so they rinse clean in hard water.

Homemade vs store-bought shampoo

Wet hands working white shampoo lather over a bathroom sink, a pump bottle of homemade shampoo on the edge
The sulfate-free recipe lathers less than store shampoo but cleans as well at the same active content.
FeatureSulfate-freeClassic SLESCastile + rinseStore shampoo
Main surfactantDecyl glucoside + betaineSLES + betainePotassium soapSLES or sulfate-free blend
pH5 (adjusted)5 to 5.5 (adjusted)About 93.5 to 9; most above 5.5
FoamModerateHighModerate, low in hard waterHigh
Hard waterRinses cleanRinses cleanLeaves film without rinseRinses clean
ConditioningGlycerin onlyGlycerin onlyNoneSilicones, cationic polymers
Shelf life3 months preserved3 months preservedTwo weeksYears, factory sealed

Store shampoos carry conditioning polymers such as polyquaternium-10 and guar hydroxypropyltrimonium chloride. These carry a positive charge, stick to the negative spots on damaged hair and stay behind after rinsing to cut friction. The homemade recipes leave them out, so follow with a conditioner if your hair tangles.

Want conditioning?

For a two-in-one, add 0.3% guar hydroxypropyltrimonium chloride to the sulfate-free recipe in place of part of the xanthan gum. Disperse it in the glycerin with the gum and keep the pH at 5.

Troubleshooting

ProblemCauseFix
Hair feels waxy or heavyCalcium soap from castile in hard waterUse the vinegar rinse or switch to a surfactant recipe.
Hair frizzy and tangledpH too highTest the pH; bring it to 5.
Shampoo wateryNo thickener, or salt in a glucoside recipeAdd xanthan gum as a glycerin slurry.
Lumps or “fish eyes”Xanthan gum added straight to waterStrain, and pre-mix the gum with glycerin next time.
Thick foam layer in the bottleStirred too fastLeave overnight; stir slowly next time.
Scalp itchy or dryToo much surfactant for your scalpDrop to the 9% setting or wash less often.
Cloudy, smells sour, or spotsMicrobial growthDiscard it. Use a preservative and sterilize the bottle.
Stings the eyespH too low or too high, or SLESKeep pH 4.5 to 5.5; use the sulfate-free recipe.

The mistake that matters

Do not skip the preservative to keep the recipe “natural” and then store the bottle in a warm shower. Water, surfactant and warmth grow bacteria such as Pseudomonas within days, and you rub it into your scalp. No preservative means a fridge and a one-week batch.

Safety

Before you start

  • Protect your eyes. Concentrated decyl glucoside, SLES and betaine cause serious eye damage. Wear glasses while handling them and rinse with running water for 15 minutes after a splash.
  • Wear gloves with concentrates. Undiluted surfactants dry and irritate skin; diluted shampoo does not.
  • Use a cosmetic preservative at its stated dose. More is not safer: preservatives above their limit irritate skin.
  • Patch test. Rub a little diluted shampoo on your inner arm and wait 48 hours before the first wash. Cocamidopropyl betaine and fragrance oils are known contact allergens.
  • Go light on essential oils. Stay at 0.5% or less, and keep tea tree and citrus oils away from cats.
  • Label it. A clear shampoo in a reused bottle can look like a drink to a child.

All three recipes are safe for septic systems at normal use. Decyl glucoside, betaine and SLES are readily biodegradable.

Homemade soap shampoo leaves hair alkaline and tangle-prone. Follow it with our guide to how to make conditioner at home, which explains why a positively charged conditioner fixes that.

Frequently asked questions

Can you make shampoo at home?

Yes. Mix a mild surfactant such as decyl glucoside with cocamidopropyl betaine and distilled water, thicken it with xanthan gum, add a cosmetic preservative and adjust the pH to about 5 with citric acid.

What is the best pH for shampoo?

Between 4.5 and 5.5. Hair carries a negative charge above about pH 3.7, and an alkaline shampoo raises that charge, which increases friction, frizz and cuticle damage.

Is castile soap good for washing hair?

Not on its own. Castile soap has a pH near 9 and forms calcium soap in hard water, which leaves hair dull and waxy. Follow it with an apple cider vinegar rinse, diluted 1:1 with water, if you use it.

Is baking soda safe as shampoo?

No. Baking soda is alkaline, so it lifts the cuticle and raises the charge on the hair, and it is not a surfactant, so it removes little oil.

Do I need a preservative in homemade shampoo?

Yes, if you keep it longer than a week. Water-based shampoo grows bacteria and mold, so use a broad-spectrum cosmetic preservative or make small batches and refrigerate them.

How long does homemade shampoo last?

About three months with a preservative and a clean bottle. Without one, keep it in the fridge and use it within a week.

How do I make homemade shampoo thicker?

Add xanthan gum pre-mixed in glycerin to a sulfate-free recipe. Shampoos made with SLES thicken with a small amount of salt, added a little at a time.

What is a natural alternative to sulfates in shampoo?

Decyl glucoside and coco glucoside are made from plant sugars and coconut fatty alcohol. Combined with cocamidopropyl betaine they clean well and are gentle on the scalp.

Why does my homemade shampoo leave my hair greasy?

Either the surfactant level is too low for your scalp or calcium soap from castile soap is coating the hair. Raise the active surfactant to 15% or switch away from soap.

Can I add essential oils to homemade shampoo?

Yes, at 0.5% or less of the batch. Higher amounts irritate the scalp and some essential oils are common contact allergens.

Sources

Avatar photo

Dr. Maya Patel

PhD in Particle Physics from Imperial College London, followed by five years at CERN working on detector calibration. Left the lab to write full-time after realizing she spent more hours explaining her research to friends than actually running it. Has reported from accelerator facilities, telescope arrays, and chemistry labs on four continents. Treats every discovery as a story that deserves an audience beyond the people who made it.

Post navigation