This article explains how to reset an Android device to factory default settings using the Settings app or "Recovery" mode if you are having serious problems booting the operating system.
Steps
Method 1 of 2: Using the Settings App

Step 1. Launch the Device Settings app by selecting this icon

Step 2. Scroll down the menu that appeared to be able to select the Backup and Restore option
It is visible within the section Personal or Privacy depending on the device model and the version of Android you are using.
If you are using a Samsung Galaxy device, select the item General management, then choose the option Reset.

Step 3. Select the Factory data reset option
It is the last item in the new menu that appeared.

Step 4. Press the Reset Device button
The reset process will erase all the data in the memory of the smartphone or tablet and will restore the configuration it had when you purchased it.
If you are using a Samsung Galaxy, press the button Reset.

Step 5. Enter the device unlock code
If you have set a PIN, password or sign to access the device's Home, you will need to enter it now.

Step 6. Press the Clear All button to confirm
The internal memory of the device will be formatted and the factory default configuration will be restored. The recovery process may take several minutes to complete.
If you are using a Samsung Galaxy device, press the button Delete everything.
Method 2 of 2: Use Recovery Mode

Step 1. Press and hold the "Power" button
Use the "Recovery" mode only if you are unable to restore via the Settings app

Step 2. Select the Shut Down option
Depending on your device model and Android version, you may need to press the "Power Off" button again to confirm your action.
If your device's touchscreen is frozen and unresponsive, press and hold the power key until your smartphone or tablet turns off completely

Step 3. Press the combination to enter "Recovery" mode
In most cases, you need to hold down the "Power" and "Volume Down" keys, but the combination can change depending on the device model:
- Nexus devices - "Volume Up", "Volume Down" and "Power";
- Samsung devices - "Volume Up", "Home" and "Power";
- Moto X - "Volume Down", "Home" and "Power";
- Other devices use the "Volume Down" and "Power" key combination. For devices with a physical "Home" key, you will need to press the "Home" and "Power" key combination.

Step 4. Wait for the Android logo to appear on the screen
This is the same logo that appears on the screen when you install an operating system update.

Step 5. Scroll through the menu that appeared to be able to select the Wipe data / factory reset item
Use the volume control keys to scroll through the menu options.

Step 6. Press the "Power" button
This will select the chosen option.

Step 7. Select the Yes item
This will confirm your action.

Step 8. Press the "Power" button again
The formatting and restoring process of your Android device will start. The factory configuration settings will be restored.