Erasing data on an iPhone is pretty easy, especially if you’re simply looking to erase your apps and data and reinstall them fresh. (This tack can be useful if you’re having

There are two main scenarios in which erasing an iPhone is called for: Either you’re getting a new phone, or the one you have is having problems.

The most common reason involves iPhone owners who trade up to newer models, usually in the fall after Apple unveils its latest line-up. Let's say you buy the new iPhone X and then plan to trade in or sell your older iPhone 7; you’ll need to make sure your data is no longer present once the old phone leaves your possession.

Or, if an iPhone gets glitchy, and you’ve done what you can to troubleshoot the issues, erasing the device and restoring can clear things up.

Here’s what you need to know.

What to do before you erase

Erasing data on an iPhone is pretty easy, especially if you’re simply looking to erase your apps and data and reinstall them fresh. (This tack can be useful if you’re having problems and want to install a fresh copy of iOS 11 and your apps.) If that’s the goal, you can skip this section and jump to the end of this piece, where the detailed steps are outlined.

However, if you plan to sell your iPhone (or give it away), these are the steps you should take before erasing the phone.

Apple Unpair your Apple Watch before wiping your iPhone.

1: Unpair your Apple Watch

Apple Watch owners should first unpair the Watch. Unpairing will save current Watch data – like step counts, calories burned, and other fitness metrics – to the phone, and free up the Watch to be paired with your replacement iPhone. Doing this step first ensures you’ve saved the most current Health metrics to your iPhone.

To unpair a Watch and backup the Watch data to the phone, tap on the Watch app located on the iPhone, tap the Watch entry located at the top, tap the “i” and then tap Unpair Apple Watch. This will create a backup of the Watch data before restoring the Watch to its factory defaults, ready to pair with another device.

You can also unpair the Watch using the Watch itself. To do so, tap Settings: General: Reset on the Watch. This, again, will cause the data to back up to your phone, while prepping the Watch for first-time use with a new device. Note: unpairing the Watch using this method retains its Activation Lock, a security feature that prevents a stolen Watch from ever being usable again to someone who has “found” it.

[ To comment on this story, visit Computerworld's Facebook page. ]

Apple Before erasing your iPhone, make a backup.

2: Back up your iPhone data

Now that Watch data has been saved to your phone, the next step is to back up the iPhone itself. The quick way to do so is to head to Settings and tap your info at the very top of the app. Tap the iCloud section, scroll to iCloud Backup, tap the selection, and on the next screen, tap Back Up Now. Doing so will back up all your iPhone data – including the up-to-date Watch data collected when you unpaired it from the phone.

(This iPhone data can then be restored during the initial set up on the new device.)

It’s also possible to back up the iPhone to your Mac or PC using iTunes. The fastest way is to connect the iPhone via the Lightning USB cable, which will display the iPhone info dashboard within iTunes, with a clearly defined “Back Up Now” button.

One side note: if you are about to switch to an Android device, you should unregister from Apple’s Messages service so that your next phone will be able to receive SMS messages without issue.

Apple Turn off Find My iPhone before erasing the device.

When the iPhone backup is complete, tap to go back to the iCloud settings screen and scroll down to Find My iPhone. This step is very important if you do not intend to use this iPhone again. (The iPhone should prompt you for an iCloud name and password to deactivate Find My iPhone before the erase begins, but it’s good to get this out of the way now. If this step is skipped the next owner will be unable to use the iPhone for anything other than a paperweight or door stop.)

3: Final step – erase

Finally, with your iPhone (and Watch) data now backed up, it’s time to erase your iPhone. Go to the Settings app and tap on the General section. Scroll to the bottom and tap Reset. On the next screen, tap Erase All Contents and Settings.

Apple Erase your content and all settings.

(You'll see several other options in this section: Reset All Settings, which doesn't delete your data; Reset Network Settings, which is pretty self-explanatory; and the other options that let you reset keyboard dictionary, your home screen or geolocation and privacy data.)

After you tap Erase All Contents and Settings, that’s it; the iPhone will remove your data and return the device to factory defaults. If you’re getting rid of the old device, you’re good to go. If you want to reinstall the latest version of iOS as well as a clean copy of your apps and data, simply set up the phone using your most recent backup from either iCloud or iTunes.