While adding a little cold water with baking soda or vinegar to the cooking water helps, the truly foolproof trick used by many professional chefs relies on thermal shock and mechanics:
A “hot start” followed by an ice bath shock and shaking
Don’t start with cold water: Add the eggs to the water only when it’s already boiling. The sudden thermal shock will cause the white to immediately shrink, preventing it from sticking to the inner membrane of the shell.
Adding vinegar or baking soda to the cooking water: Add 1 teaspoon of baking soda or a little vinegar to the water. Baking soda raises the pH level (making it easier to peel the white from the membrane), while vinegar slightly softens the calcium shell.
Ice bath: Immediately after the required cooking time, remove the eggs and place them in a bowl of ice water for at least 3–5 minutes.
Don’t start with cold water: The shaking trick (cooking tip): Place the cooled eggs in a sealable container (or glass) with a little cold water and shake them vigorously. The impact will create fine cracks in the shell, allowing water to penetrate between the shell membrane and the white. The shell can then be peeled off in almost one piece.