HTC Desire 820 hard reset using buttons

Be sure to back up any data and files you want to keep before you do a factory reset
Performing a factory reset using hardware buttons
The Fast boot option in Settings > Power must not be selected
If you can’t turn HTC Desire 820 Android phone on

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. All data will be lost!
Restores your phone to its original state.

HTC Desire 820 hard reset from the menu

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.
4. Tap OK.

HTC Desire 820 soft reset

If HTC Desire 820 does not respond when you touch the screen or press the buttons, you can still restart it.
Press and hold the POWER button for at least 10 seconds, and then release it. HTC Desire 820 then restarts.

General advice: Before you buy a new cell phone or new tablet, please try the following procedure to repair your device in a software way. First charge your battery, backup your important data if possible and in most cases take out SIM and SD card before doing factory reset. It is impossible to recover your data after doing a hard reset, so online backup is always important. For all of your data, a backup should be done on an external device, hard drive, raid system or media. With or without insurance, if your cell phone lost, damaged or stolen at least your invaluable data is backed up in a safe place. If you are about to sell your phone and you want to wipe your personal data, or if your phone affected with virus you have to do a hard reset. In some cases, you can delete the forgotten password or lock pattern from your device as well. All information is for devices with stock based ROMs. If you are using rooted device, always back up your EFS folder first, containing your IMEI info, etc.! Please also note, that a hard reset operation will not unlock your mobile phone's SIM lock or network lock, but it will remove the unlock pattern, remove the user password or PIN password (NOT the SIM card's 4 digit PIN code). Also note that the firmware version will not be affected in any way, it will not be downgraded, it will remain the same you are using and if you have rooted your device, root privileges remain also unaffected.