If you are going to sell, give away, or simply want to free up space on your device, it is essential to erase the data from an iPhone safely. Apple offers tools built in that allow you to delete all data without leaving a trace.
First, make sure to make a backup copy in iCloud or on your computer, so you don’t lose photos, contacts, or important documents. Then, go to Settings → General → Transfer or reset iPhone → Erase All Content and Settings. Enter your password and confirm the action. This will delete apps, photos, contacts, accounts, and system settings.
If you use iCloud and Find My iPhone, turn it off before erasing the device, otherwise the iPhone will remain linked to your account.
You can also erase the data using iTunes or Finder by connecting your iPhone to the computer and selecting Restore iPhone. This will reinstall iOS and leave the device like new from the factory.
In summary, erasing the data from your iPhone is a simple process, but you must follow the steps correctly to protect your privacy and make sure the device is ready for a new user.