You cannot recover a passcode you set yourself — Apple does not store it

Your iPhone passcode is encrypted on your device in a way that Apple cannot decrypt, even with your account information. This is intentional: it means no one — not Apple, not a hacker, not law enforcement — can force your phone open by guessing or brute-forcing the code. The trade-off is that if you forget it, there is no "forgot passcode" link like you would use for a website password.

You have two paths forward. The first requires an Apple ID and a computer or another device. The second erases everything on your phone and requires proof you own it. Which one you use depends on whether you remember your Apple ID password and whether you have a backup you want to keep.

Key Takeaways

  • If you remember your Apple ID password, you can use Find My iPhone on iCloud.com or another device to erase your phone remotely, then set a new passcode during setup.
  • If you do not remember your Apple ID password, you will need to reset that first through Apple's account recovery process before you can erase your phone.
  • Erasing your phone removes all data unless you have a backup stored in iCloud or on a computer, which you can restore after setting a new passcode.
  • If you cannot access your Apple ID at all, you may need to visit an Apple Store with proof of purchase or identity to verify ownership before they will help.

Using Find My iPhone if you know your Apple ID password

Go to iCloud.com on any computer or another device and sign in with your Apple ID and password. Click "Find My" in the app launcher (the grid of nine dots), then select "Find My iPhone" from the menu on the left.

Find your iPhone in the list of devices. Click it, then click "Erase iPhone" at the top of the panel. Confirm the action. Your phone will erase remotely, and you will be able to set a new passcode when it restarts. If your phone is off or not connected to the internet, the erase command will go through the next time it connects.

After the erase completes, your phone will walk you through setup. You will create a new passcode at that point. If you have an iCloud backup, you can restore your data — photos, messages, apps, settings — during setup or afterward in Settings > [Your Name] > iCloud > Manage Storage > Backups.

Resetting your Apple ID password if you are locked out of that too

Go to iforgot.apple.com on any device. Enter your Apple ID (usually your email address) and follow the prompts. Apple will ask you to verify your identity through a trusted phone number, a recovery key, or security questions you set up previously.

If you have a trusted device — an iPad, Mac, or another iPhone you use with the same Apple ID — Apple can send a verification code there. If you do not have access to any of those, you will need to answer the security questions you created when you set up your Apple ID, or use a recovery key if you saved one.

Once you reset your Apple ID password, go back to iCloud.com, sign in with your new password, and follow the Find My iPhone steps above to erase your locked phone and set a new passcode.

What to do if you cannot access your Apple ID at all

If you do not remember your Apple ID password and cannot verify your identity through a trusted device, recovery key, or security questions, you will need to contact Apple Support or visit an Apple Store in person. Bring a photo ID and proof of purchase (a receipt, credit card statement, or order confirmation from Apple).

Apple will verify that you own the device and account, then help you regain access to your Apple ID. This process can take several days if done by phone, or a few hours if you go to a store. Once your Apple ID is accessible again, you can erase your phone and set a new passcode using the Find My iPhone method.

Erasing your phone at the device itself if you have tried multiple passcodes

If you have entered an incorrect passcode too many times, your iPhone will disable itself temporarily — first for one minute, then five minutes, then fifteen minutes, and so on. After ten failed attempts, the phone locks for one hour. After more failures, it may ask you to try again in 24 hours.

You cannot force an erase by entering the wrong code repeatedly. You must use Find My iPhone or visit Apple Support. However, if you reach a screen that says "iPhone Unavailable" and offers "Emergency SOS" or "Medical ID", you can tap "Emergency SOS" to call for help, but this does not unlock the phone.

Protecting yourself from this situation in the future

Write your passcode down and store it somewhere find — a physical notebook in a safe, a password manager like 1Password or Bitwarden, or a trusted person's hands. This is not the same as writing it on a sticky note on your monitor. A locked notebook in a drawer or a password manager with its own strong password is reasonable.

Turn on iCloud backups so that if you ever need to erase your phone, your data is already backed up and waiting to restore. Go to Settings > [Your Name] > iCloud > Backup and toggle "iCloud Backup" on. Your phone will back up automatically when it is plugged in, locked, and on Wi-Fi.

Save your Apple ID recovery key somewhere safe as well. Go to Settings > [Your Name] > Password & Security > Recovery Key and follow the prompts to generate and save it. This key lets you reset your Apple ID password even if you lose access to your trusted devices.

Why your passcode is not recoverable and what that means for your security

Apple encrypts your passcode using a method called key derivation, which turns your passcode into a long string of characters that unlocks your phone's data. The encryption is one-way: Apple can check whether a passcode is correct, but cannot reverse-engineer what the passcode is from the encrypted version. This is why there is no "reset passcode" option like there is for your Apple ID password.

This design protects you. It means that if someone steals your phone, they cannot call Apple and pretend to be you to unlock it. It also means that if Apple's servers are hacked, your passcode is not exposed. The downside is that you are responsible for remembering it or storing it safely. There is no backdoor, and Apple cannot create one without weakening security for everyone.

Frequently Asked Questions

Can Apple unlock my iPhone without erasing it?

No. Apple cannot decrypt your passcode or bypass it without erasing the phone first. If you want to keep your data, you must have a backup in iCloud or on a computer that you can restore after the erase.

What if I do not have a backup and I erase my phone?

Your data will be gone. You can prevent this in the future by turning on iCloud Backup in Settings > [Your Name] > iCloud > Backup. If you have already erased, check whether you have an older backup by signing into iCloud.com and looking at your backup history, though it may be weeks or months old.

Can I use my fingerprint or face to unlock my phone if I forgot the passcode?

No. Face ID and Touch ID require your passcode as a backup. If you forget the passcode, you cannot use biometrics to unlock the phone. You must erase it and set a new passcode.

How long does it take to erase my phone through Find My iPhone?

If your phone is on and connected to the internet, the erase usually completes within a few minutes. If your phone is off or offline, the erase command waits until it connects, which could be hours or days later.

Will erasing my phone remove it from my Apple ID account?

No. After you erase your phone, it will still be listed in Find My iPhone under your Apple ID. You can remove it manually by going to iCloud.com, clicking Find My, selecting the device, and clicking "Remove from Account" if you no longer own it.