Put the iPhone into Recovery Mode
Connect the iPhone to a Mac or PC with a USB cable
Open Finder on macOS Catalina or later
Open iTunes on macOS Mojave or earlier, or on Windows
Select the iPhone when it appears
Choose Restore iPhone
Confirm the restore
Wait for the erase and reinstall process to finish
Set up the iPhone as new or restore from a backup
If Activation Lock appears, sign in with the Apple ID previously used on the device
