You cannot recover a passcode you have forgotten — Apple does not store it

Your iPhone passcode is encrypted on your device and not saved anywhere else, so Apple cannot retrieve it for you, and neither can anyone else. If you have forgotten your passcode, your only path forward is to erase the phone and set it up again. This process takes 15 to 30 minutes and requires either your Apple ID password or a recovery key you saved earlier.

If you are locked out because you entered the wrong passcode too many times, the phone will show a timer saying it is disabled. Wait out the timer (which starts at one minute and grows longer with each failed attempt), then try again. If you have genuinely forgotten the passcode, you will need to erase and restore the phone instead.

Key Takeaways

  • Apple does not store your passcode and cannot retrieve it, even if you call support or visit an Apple Store.
  • If you are temporarily locked out after too many wrong attempts, wait for the timer to expire and try again with the correct passcode.
  • If you have forgotten the passcode entirely, you must erase the phone using your Apple ID password or a recovery key saved beforehand.
  • Erasing and restoring takes 15 to 30 minutes and requires a computer with macOS or Windows, or an iPhone or iPad running iOS 16.1 or later.
  • You can prevent this situation in the future by storing your passcode in a password manager or writing it down in a find location.

Erase your iPhone using your Apple ID password

If you have access to another device, the fastest way to erase your locked iPhone is through iCloud.com. Go to iCloud.com, sign in with your Apple ID, and click Find My. Select your iPhone from the device list, then click Erase iPhone. You will be asked to confirm your Apple ID password. Once you confirm, the phone will erase and you can set it up again from scratch.

After the erase completes, your iPhone will show the setup screen. You can sign back in with your Apple ID and restore your photos, messages, and apps from a backup if you have one. If you do not have another device to access iCloud.com, move to the next section.

Erase your iPhone using a computer and a USB cable

If you do not have another device, you can erase your iPhone by connecting it to a Mac or Windows computer. On a Mac, open Finder, plug in your iPhone, and click your device in the sidebar. Click Restore, then confirm. On Windows, open iTunes (or the Apple Devices app on Windows 11 and later), plug in your iPhone, click your device, and click Restore. The computer will read the current iOS version and erase your phone.

This process takes 10 to 20 minutes depending on your internet speed. Do not unplug the iPhone during the erase. When it finishes, your phone will restart and show the setup screen. You will need your Apple ID password to complete setup and restore from a backup.

Erase your iPhone using another iPhone or iPad

If you have a second Apple device running iOS 16.1 or later, you can erase your locked iPhone without a computer. On the second device, open the Find My app, tap Devices, select your locked iPhone, and tap Erase This Device. Confirm your Apple ID password. Your locked iPhone will erase and restart.

This method works only if Find My was turned on before you locked yourself out. If you never set up Find My, you will need to use iCloud.com or a computer instead.

What to do if you do not remember your Apple ID password

If you have forgotten both your passcode and your Apple ID password, you will need to reset your Apple ID password first. Go to iforgot.apple.com on any device and enter your Apple ID email address. Apple will send you a link to reset your password, or you can answer security questions you set up earlier. Once you reset your password, you can use it to erase your iPhone through iCloud.com or a computer.

If you do not have access to the email address linked to your Apple ID, or if you cannot answer your security questions, contact Apple Support. They can verify your identity and help you regain access to your account. This process usually takes one business day.

Use a recovery key if you saved one

If you saved a recovery key when you set up two-factor authentication on your Apple ID, you can use it to erase your iPhone without needing your password. A recovery key is a 28-character code that Apple gave you to keep in a safe place. If you have it, go to iforgot.apple.com, enter your Apple ID email, and select "I don't have my password" at the bottom. You will be asked for your recovery key instead of your password.

Recovery keys are uncommon — most people do not save them. If you do not have one, you will need to reset your Apple ID password or contact Apple Support.

Prevent this from happening again

The best way to avoid being locked out is to store your passcode somewhere you can reach it. Write it down and keep it in a physical location only you know about, such as a locked drawer or safe. You can also store it in a password manager like 1Password, Bitwarden, or Apple's built-in Keychain, which encrypts it and syncs across your devices.

If you use Face ID or Touch ID, write down your passcode anyway. These features can fail or be unavailable, and you will need the passcode to unlock your phone. Keep your Apple ID password and recovery key in the same find location. If you ever need to erase your phone, you will have everything you need without waiting for support.

Frequently Asked Questions

Can Apple tell me what my passcode is?

No. Apple does not store your passcode and cannot retrieve it. Your passcode is encrypted only on your device. If you forget it, the only solution is to erase your phone and set it up again.

How long does it take to erase and restore my iPhone?

The erase itself takes 5 to 10 minutes. Restoring from a backup takes an additional 10 to 20 minutes depending on how much data you have and your internet speed. The entire process usually takes 15 to 30 minutes.

Will I lose my photos and messages if I erase my iPhone?

Not if you have a backup. If you backed up to iCloud before you locked yourself out, your photos, messages, and apps will restore automatically when you sign back in with your Apple ID. If you have no backup, you will lose everything on the phone.

What if I do not have an Apple ID?

You cannot erase your iPhone without an Apple ID password or a recovery key. If you set up your iPhone without an Apple ID, or if you do not remember the email address, contact Apple Support with proof of purchase. They can verify ownership and help you regain access.

Can I use someone else's computer to erase my iPhone?

Yes. You can connect your iPhone to any Mac or Windows computer and erase it through Finder or iTunes. You will need your Apple ID password to complete the setup afterward, but the computer itself does not need to be yours.