A factory restore erases the information and settings on your iPhone, iPad or iPod and installs the latest version of iOS, iPadOS or iPod software.
Get your device ready
1. Make sure your Mac or PC is up to date. If you're using iTunes, make sure you have the latest version.
2. If you want to save the information on your iPhone, iPad or iPod, create a backup.
3. Go to Settings > [your name] > Find My, tap Find My iPhone, then turn it off. Find out what to do if your device is unresponsive or won't turn on. Get help if you've forgotten your passcode.
Restore your device to factory settings
1. On a Mac with macOS Catalina or later, open the Finder. On a Mac with macOS Mojave or earlier, or on a PC, open iTunes. Find out which macOS your Mac is using.
2. Connect your device to your computer.
3. If a message asks for your device's passcode or to Trust This Computer, follow the onscreen steps. Get help if you've forgotten your passcode.
4. Select your device when it appears on your computer. Find out what to do if your iPhone, iPad or iPod touch is unresponsive or won't turn on. Or get help if your device doesn’t appear on your computer.
5. Click Restore [device]. If you’re signed in to Find My, you need to sign out before you can click Restore.
6. Click Restore again to confirm. Your computer erases your device and installs the latest iOS, iPadOS or iPod software.
7. After your device has been restored to its factory settings, it will restart. Now you can set it up as new.
Above content referenced: Apple.com, November 03, 2021, Restore your iPhone, iPad or iPod to factory settings, <https://support.apple.com/en-gb/HT201252>