To factory reset an iPhone, the simplest way is through the Settings app:
- Open Settings and go to General > Transfer or Reset iPhone.
- Tap Reset, then choose Erase All Content and Settings.
- You may need to enter your passcode and Apple ID password to confirm.
- Follow the prompts and tap Erase iPhone.
- The phone will erase all data and restart to factory settings.
If you don't have the passcode and need to reset a locked iPhone, connect it to a computer, enter recovery mode, and restore via Finder or iTunes. This process will erase everything on the device, so backing up beforehand is important if you want to keep your data.
