Use Apple’s Erase All Content and Settings command when you want to wipe an iPhone before selling, trading, or giving it away. Back up anything you want to keep first.
- Open Settings > General > Transfer or Reset iPhone.
- Tap Erase All Content and Settings.
- Review what will be removed and tap Continue.
- Enter the iPhone passcode and, if requested, your Apple Account password.
- Choose what to do with the eSIM when prompted, then confirm the erase.
The iPhone removes your personal data and returns to the setup screen. When preparing a device for another owner, make sure Activation Lock is removed as part of the process and do not hand over the phone while it is still signed in to your account.
If the iPhone cannot be unlocked normally, use Apple’s recovery and restore procedures instead of trying to bypass the passcode.