Start eggs in already-hot water or steam (not a cold-water start), then chill them hard. Serious Eats’ J. Kenji López-Alt recommends lowering fridge-cold eggs into boiling water or steaming them, cooking about 11 minutes for hard-cooked eggs, and immediately shocking them in an ice bath for at least 15 minutes (or refrigerating overnight) so the white firms and pulls away from the shell membrane.
Crack the shell all over and peel under cool running water; the water helps lift the membrane. A hot start plus a full chill is what makes shells slip off cleanly far more often than slow cold-water cooking.
Source: How to Make Perfect Hard-Boiled Eggs | The Food Lab — Serious Eats