Back up your iPhone to iCloud or a computer
Sign out of iCloud and Apple ID
Turn off Find My iPhone
Sign out of iMessage and FaceTime
Unpair Apple Watch and other Bluetooth devices
Remove eSIM or contact your carrier if needed
Erase all content and settings
Wait for the device to restart to the Hello screen
Remove the iPhone from your Apple ID account on another device if needed
Remove the SIM card
Clean the device and gather accessories before selling
