Restore iPhone to factory settings
You can use a Mac or Windows PC to erase all data and settings from your iPhone, restore iPhone to factory settings, and install the latest version of iOS.
Important: Restoring your iPhone to its factory settings erases all your data and settings. However, before iPhone is erased, you have the option to back up your iPhone. If you make a backup, you can use the backup to restore your data and settings on your iPhone or on a new device. See Restore iPhone from a computer backup.
Do one of the following:
In the Finder sidebar on your Mac: Select your iPhone, click General at the top of the window, then click Restore iPhone.
Note: To use the Finder to restore iPhone to factory settings, macOS Catalina is required. With earlier versions of macOS, use iTunes to restore iPhone.
In the iTunes app on a Windows PC: Click the iPhone button near the top left of the iTunes window, click Summary, then click Restore iPhone.
Follow the onscreen instructions.
See the Apple Support article If you can’t update or restore your iPhone, iPad, or iPod touch.