Despite relying mainly on Face ID or Touch ID, the system software on your iPhone can occasionally request the 4-6 digit device passcode for authentication. That helps improve security. But if you’ve forgotten your iPhone passcode, you’ll quickly end up locking yourself out of the smartphone.

When that happens, the only way to change the iPhone passcode is to reset the device to factory settings. Below, you’ll learn of multiple ways to go about doing that and—hopefully—get your data back in the process.

Table of Contents
    Someone holding an iPhone on the Passcode screen

    Methods to Factory Reset Your iPhone?

    If you’ve forgotten your iPhone passcode, you can make use of three different methods to restore your iPhone to factory settings. Since the procedure erases all personal data on your device, go through each of them carefully and pick the option that suits you.

    Method #1: Restore Normally Using Mac or PC

    Have you previously backed up or synced your iPhone to a particular Mac or PC? If so, you can reconnect it to the same computer and create a fresh backup to iTunes or Finder without entering the device passcode. That allows you to get your data back later.

    If you’ve disabled your iPhone’s Find My iPhone functionality in the past, you can also reset the device to factory settings using iTunes/Finder normally. However, that is unlikely to be the case, which means that you’ll have to resort to utilizing Recovery Mode.

    Note: If your computer prompts you to provide permission to access the contents on the iPhone, or if it asks you to disable Find My iPhone, you must move on to the next method immediately. 

    1. Connect your iPhone to your Mac or PC. Then, open iTunes or Finder and select the iOS device. 

    2. Pick the Back up all of the data on your iPhone to this Mac option and select Back Up Now to create a fresh local backup. You can opt to create an encrypted backup if you want it to include sensitive information such as your health data, saved passwords, and Wi-Fi settings.

    Back Up Now button

    3. Once you’ve finished creating the backup, select the Restore iPhone option. 

    Restore iPhone button

    4. Select the Restore option to confirm that you want to reset the device to factory defaults.

    Restore option

    5. Follow the remaining instructions to reset your iPhone to factory settings.

    Method #2: Restore Using Recovery Mode

    If you’ve never connected your iPhone to a Mac or PC, or if the device is secured with Find My iPhone, you must use Recovery Mode to factory reset your device. This will also help if you’ve forgotten your iPhone’s passcode. 

    1.  Connect your iPhone to your Mac or PC. If it’s a computer that you use to back up or sync your iOS device regularly, you should be able to create a fresh backup before proceeding.

    2. Enter Recovery Mode. That involves pressing and holding the Side, Home, or Volume Up/Down buttons on the iPhone. Check out this guide about force-restarting and entering Recovery Mode for device-specific instructions.

    3. Select Restore iPhone.

    Restore iPhone button

    4. Select Restore and Update.

    Restore and Update button

    iTunes/Finder should begin to automatically download the latest version of the iPhone’s system software before resetting the device. If your iPhone reboots automatically in the meantime, you must re-enter Recovery Mode.

    5. Follow the on-screen instructions to reset your iPhone to factory defaults.

    Method #3: Restore Using

    The Find iPhone web app at gives you the option to erase the data on your iPhone and revert it to factory settings. It’s an alternative method that you can use if you don’t have a computer at hand. 

    However, you can only use this method if Find My iPhone is active on your device (which is likely the case).

    1. Sign in to using any web browser and select Find My.

    2. Pick your iPhone.

    3. Select Erase iPhone.

    4. Select Continue.

    Find My > Erase iPhone > Continue

    5. Follow the rest of the instructions to factory reset the device.

    Factory Reset Complete: What You Must Do Next

    After you’ve factory reset your iPhone, the device should boot into the Setup Assistant automatically. Work your way through it, and you can change your device passcode once you arrive at the Create a Passcode screen.

    Create a Passcode screen

    By default, the Setup Assistant prompts you to set up a 6-digit passcode. To make things easier, tap Passcode Options and change that to a 4-digit passcode instead.

    If you have an iTunes/Finder or an iCloud backup, you can choose to restore it at the Apps & Data screen. Pick between the Restore from iCloud Backup or Restore from Mac or PC options as needed.

    Restore data options on Apps & Data screen

    You must then sign into the iPhone. If Find My iPhone was active on your device before the reset procedure, you must use the same Apple ID that you used to sign in to the device the last time.

    Passcode Changed: Don’t Forget It Again

    Since you don’t use the iPhone passcode too much, it’s quite easy to forget. Make it a point to set one that you can remember—without making it easier for others to guess—so that you don’t run into the same issue repeatedly. It’s also best to perform regular backups to a Mac/PC or iCloud, just in case you do forget again.