If you have ever boiled a very fresh egg and ended up removing half the white along with the shell, there is a scientific reason for the frustration. Egg age can influence how easily a hard-cooked egg peels, and the key changes happen inside the shell rather than in the shell itself.
As an egg sits in storage, carbon dioxide gradually escapes through the microscopic pores of its shell. That changes the chemistry of the albumen, or egg white, raising its pH. The shift weakens the interaction between the cooked egg white and the inner shell membrane, making the shell easier to separate. The U.S. Department of Agriculture notes that fresh egg albumen has a pH of about 7.4, while aging can raise it toward approximately 9. So the secret to an easier-to-peel boiled egg is not necessarily a special trick with vinegar or salt. It begins with chemistry and time.