How you factory reset HTC One M8

This is needed at times, nothing to be afraid of. It’s btw the same way used for One M7, besides erasing the sd card.

Performing a factory reset from settings

  1. Go to Settings, and then tap Backup & reset.
  2. Tap Reset phone.
  3. If you want to delete media, documents, and other data from the phone storage, select Erase all data.

    To also delete media and other data from your storage card, select Erase SD card. Tap OK.

Performing a factory reset using hardware buttons

In case you can’t access the settings inside the phone, like you’ve forgotten your unlock pattern etc. 

You MUST disable Fast Boot under Settings > Power first
  1. Press and hold the VOLUME DOWN button, and then press and hold the POWER button.
  2. Wait for the screen with the three Android images to appear, and then release the POWER and VOLUME DOWN buttons.
  3. Press VOLUME DOWN to select FACTORY RESET, and then press the POWER button.

It’s very similar (the same I think) way used on One M7 etc.