If you celebrate Easter, you’ll likely be embarking on the questionable quest to hide a bunch of hard-boiled eggs around your house and hope—oh, hope beyond hope—that all of them get found. Before the hunt, though, you’ll have to dye those eggs in a stinking bath of food dye, water, and vinegar. The vinegar part has always bugged me. Hard boiled eggs have a pungent enough aroma on their own; why do we need to add another acrid smell to the dying process?

It’s not just to keep the kids dunking instead of drinking, it turns out. Most food dyes are acid dyes, so called because they only work in acidic conditions. The vinegar—a solution of 5 percent acetic acid in water—is there to bring the pH low enough that the dye will actually bind. But is there an ideal pH for perfect egg-dying saturation? A normal box of food dye says to add 1 teaspoon of vinegar for every half-cup of water—but would tweaking that acidity by adding more or less vinegar get you better results? WIRED decided to find out.

First, some explanation: Why does acid make the dyes dye better? The colored molecules themselves are sodium salts of a phenolic acid. Once those dyes get thrown into water, the sodium ions fall off, leaving behind the negatively-charged part of the molecule. Add vinegar, and you're adding lots of free protons—positively charged hydrogen ions—which fly in to take the place of those missing sodiums. The hydrogens, now associated with the dye molecules, are important because they allow hydrogen bonding. Their slightly positive charge acts like a magnet, attracting it (and the dye, in tow) to slightly negative atoms in the protein molecules and calcium carbonate (CaCO 3 ) in the eggshell.

The color you see on the egg—red, yellow, blue, green–depends on how each particular dye molecule absorbs and reflects different wavelengths of light. But the saturation of that color depends on how strong a bond you can get between the egg’s calcium-filled surface and the dye molecules. So you gotta add vinegar. But how much?

Test the pH of your solution before you add your dye; the color will interfere with the reading. Typical food dyes are acid dyes, which need protons from an acid to work correctly. Once you test your pH, add the dye, and mix well. Make sure to keep your vinegar spoons and water spoons separate to prevent any promiscuous protons from escaping. 5 minutes to go. If your dye bath is too basic, the dye won't stick, leaving you with white splotches and inconsistent color. Too acidic, and the carbon dioxide bubbles created will interfere with dye bonding. Yellow-dyed eggs get more and more saturated as the pH drops from 7 (pure water) to pH 3 (pure vinegar).

We tested the effects of different levels of normal white vinegar, 5 percent acetic acid, on the color of a hard-boiled egg, while tracking its pH. We tested six different conditions: Pure water (pH 7), a cup of water with 1/8 teaspoon of vinegar (pH 6), a cup of water with 1/2 teaspoon of vinegar (pH 5), a cup of water with 2 teaspoons of vinegar in it (pH 4), half and half water and vinegar (pH 3), and pure vinegar (also pH 3). The alkalinity of your water will have a very slight effect on the pH of those mixtures—but definitely not enough to notice in the appearance of your eggs, or enough that you'll notice it on a universal pH test strip.

We boiled all the eggs for the same amount of time and put the same amount of food coloring (6 drops) in each of our cups (controlling for the total volume of each cup, of course). After a perfectly-timed 5-minute dunk for each egg, here's what we saw:

Water-only was a disaster. As you could have predicted, a pH of 7 isn't acidic enough to activate the acid dye. We do get a little bit of color, which we can attribute to a low level of hydrogen bonding, along with a little bit of ionic bonding that might be going on.

A blue egg dyed in pure vinegar, at pH 3. Josh Valcarcel/WIRED

Then things get more interesting. Vinegar-only was good at dying the eggs a vibrant color, but it presented a different problem. There was so much bubbling on the surface of the egg when we dropped it into the vinegar that it actually left spots on the surface of the egg where the dye wasn't able to attach—a whole new kind of chicken pox. Those bubbles coming off the surface of the egg are carbon dioxide (CO 2 ), created when free protons in the acetic acid react with the CaCO 3 on the surface of the egg shells. They also created kind of a streaky effect, which as far as I can tell is probably produced when those bubbles roll up the sides of the egg.

That leaves our intermediate conditions. In the end, it comes down to this: Those boxed instructions are pretty damn good. A teaspoon of vinegar per half-cup of water gives you a pH around 4, and it consistently gave us smooth color. A slightly lower pH—the half-and-half water and vinegar—created a slightly more saturated color. More protons, more hydrogen bonding, more color attaching. But that extra acid still caused a little bit of the bubbly splotching that plagued the all-vinegar dye solution. Any more basic than pH 4, and you'll get bits of white poking through your egg.

If you're like me, and you still can't stand the smell of vinegar, now you have options! Lose the vinegar, and replace it with any other edible household acid, maybe the citric acid in some strained lemon juice. Then buy some cheap pH strips on Amazon, add just enough acid to get you to pH 4, and dunk away—minus the stinging nostrils.