Always start with eggs that are at room temperature to best predict the cooking time and minimise cracking.
For a soft-boiled egg, lower the egg into gently boiling water with a slotted spoon. Allow three and a half minutes for a medium-sized egg and four minutes for a large egg. The yolk will be runny and the white just set. Cook for a further minute if you like your soft boiled eggs a little firmer.
For a hard-boiled egg, start the egg in cold water and bring up to the boil. Once the water is gently boiling, set the timer for between 7-10 minutes depending on how well cooked you like your eggs. The longer you boil the egg, the firmer it will be.
Once cooked, plunge the hard-boiled egg into plenty of cold water for one minute. Drain and cover with more cold water. This will prevent the egg from over-cooking in its residual heat. Cracking the shell with the back of a spoon during cooling will also make the egg easier to peel.