You can't recover a forgotten iPhone passcode. Apple treats the PIN as a one-way secret, so the options are to set a new one using your Apple Account (Passcode Reset), reset the iPhone on-device, or erase and restore it with a computer. All three erase the current data unless you have a backup to restore.

That blunt fact is the most useful thing to know before you start. There's no hidden menu that reveals the old code, no Apple tool that reads it back, and no legitimate third-party app that does either. What you're really doing is regaining access and creating a fresh PIN, and the right method depends on your iOS version, whether Find My was on, and whether you can reach your Apple Account password—not the PIN itself.

If you keep reading, you'll get the exact order to try each route, what can go wrong at each step, and how to limit data loss.

First, separate the PIN from the Apple Account password

People often use "PIN code" to mean two different things, and the fix diverges sharply. The device passcode is the 4- or 6-digit number (or alphanumeric code) that unlocks the iPhone. The Apple Account password protects your account, purchases, and Find My. The device PIN is not stored anywhere you can retrieve it. Your Apple Account password is different: it's recoverable through Apple's account recovery process, and it's the credential you'll need to pass through most PIN-reset routes.

So before you touch the phone, confirm you can sign in to your Apple Account. If the passcode is forgotten and the Apple Account password is forgotten, you'll need to recover the account first, and that can take days depending on Apple's recovery waiting periods. Sort that out early, because every reset method depends on it. The old PIN itself never comes back—only a new one does.

Know the difference between "recover" and "reset"

No supported method returns the original PIN to you or a technician. What the supported methods do is authenticate you as the owner, erase the device, and let you set a new passcode.

That distinction matters because it sets expectations. You also want to link the passcode to a memorable but non-obvious number. Avoid a birth date or a repeating pattern like 0000 or 1234—those are the first codes anyone guesses, and iOS has its own lockout rules that punish wrong attempts.

If you want to avoid a repeat, plan ahead: assign a trusted recovery contact (a family member or friend) so someone can help you reset later, and keep the Apple Account password in a password manager.

The quickest route: Passcode Reset on a supported iPhone

Since iOS 17, a locked iPhone can offer Passcode Reset directly on the lock screen after failed attempts. This is the fastest path and doesn't need a computer. Apple recommends trying this first.

Prerequisites: iOS 17 or later An active cellular or Wi-Fi connection (optional: Data mode for offline recovery) Your Apple Account signed in with the password memorized Find My previously turned on

Step-by-step: 1: Enter wrong passcodes until the "iPhone Unavailable" or "Security Lockout" screen appears. 2: Tap Forgot Passcode? (the button only appears with an active connection and Find My on). 3: Tap Start iPhone Reset to confirm. 4: Enter your Apple Account password to sign out of your account. 5: Tap Erase iPhone—this permanently deletes all data and settings. 6: When it restarts, follow the setup screens, restore from a backup if you have one, and set a new passcode.

Success check: you reach the Home screen with a fresh passcode you choose, and your Apple Account is signed back in. If the Forgot Passcode? option never appears, your iOS is older, or Find My was off, move to the next route. Don't keep guessing indefinitely—the lockout timer grows.

One caveat: if you're on iOS 17 or later with an eSIM, the reset offers you a choice to keep the eSIM and erase data, or erase both. On iOS 16 or earlier, contact your carrier for an eSIM QR code before resetting.

Reset without a computer on iOS 15.2 through iOS 16

The same on-device route exists in slightly different clothing. With iOS 15.2 or later, the lock screen can show an Erase iPhone option after failed attempts instead of a Forgot Passcode? button. Prerequisites match: Find My on, an active connection, and your Apple Account password. Tap Erase iPhone, enter the Apple Account password, confirm, and let it reset. Then restore from backup and set a new PIN.

Success check and failure case are the same as above: if Erase iPhone doesn't appear, go to the computer method. Don't mistake a disabled screen waiting out a timer for a dead end—connect to Wi-Fi if the phone is offline.

Use a computer when the lock screen offers nothing

If the on-device options don't appear—older iOS, Find My off, no working connection—you can reset with a Mac or Windows PC. This requires a cable that can charge the phone, an internet connection, and up to about 60 minutes. The process erases the data currently on the iPhone.

The mechanics differ by model. Here's the sequence in general form:

1: Turn off the iPhone. For Face ID models, hold the side button and Volume Down until the power slider appears. For Home Button or top-button models, hold the top or side button. 2: Connect the cable to your computer, then to the iPhone. 3: Enter recovery mode, varying by model: iPhone 8 and later (including SE 2nd/3rd gen): quickly press Volume Up, then Volume Down, then hold the side button. Keep holding through the Apple logo until the computer-and-cable image appears. iPhone 7 and 7 Plus: hold Volume Down through the logo until the recovery image shows. iPhone 6s and earlier or SE 1st gen: hold the Home button through the logo until the recovery image shows. 4: Open Finder (macOS Catalina or later) or iTunes (Windows or older macOS). Your phone should appear as a device needing recovery. 5: Choose Update or Restore. Update installs fresh software but may preserve data. Restore wipes the device and installs the latest software. If your goal is to clear the PIN and start clean, Restore is the right choice. 6: Wait for the download and process, then set up the phone fresh, restore from a backup if available, and create a new passcode.

Success check: the phone reboots to the setup screen asking for a new passcode you choose—not your old one.

If your buttons don't respond and you can't get the recovery image, Apple says the device may need service. That's the point to stop and book a repair rather than force anything. A common failure is a cable that only charges and won't carry data; swap it before assuming the phone is broken.

What actually happens to your data

The operating system and your photos, messages, and app data sit on the same encrypted storage. The passcode is a key, and erasing the key is the only way to bypass it. That's why resetting deletes everything.

Your realistic outcomes:

iCloud backup exists: Restoring brings back most app data, photos, and messages from the last backup date. You may lose anything created since then. Computer backup exists: Same story, restored through Finder or iTunes. No backup: You start clean. Apps re-download, but local data is gone.

Before you erase, if the phone was previously trusted by a computer you still own, some data can be backed up even while the phone shows "iPhone Unavailable," depending on the iOS version and whether the computer still has the trust relationship. It's worth trying that backup first—it can save everything you'd otherwise lose.

Reinstalling from a backup without re-entering the old PIN

A frequent point of confusion: when you restore from a backup, you don't need the old passcode—you need the backup's password (if encrypted) and your Apple Account. During setup, choose Restore from iCloud Backup or Restore from Mac or PC, wait, and then set a new passcode when prompted. The old PIN stays irrelevant. If you encrypted the computer backup, you'll need that password, so check your password manager before you start.

Choosing the fastest safe path

Situation Best first move What it costs
iOS 17+ with Find My on and Wi-Fi Passcode Reset on lock screen Full erase, then restore from backup
iOS 15.2–16 with Find My on and Wi-Fi Erase iPhone on lock screen Full erase, then restore from backup
Older iOS, Find My off, or no connection Recovery mode via computer Full erase, restore from backup or start clean
No backup anywhere Any route, then set up clean Local data lost
Buttons won't respond / recovery image won't show Stop and seek service Potential repair

That table makes the decision easy, but the underlying rule is simpler: no path brings back the code, and any path to the phone erases it.

Step-by-step: a complete reset with data recovery

Here's the order I'd recommend for most people, using a computer because it works across all iOS versions:

1: Try on-device reset first (Forgot Passcode? or Erase iPhone). Fastest, no cables. 2: Back up if a trusted computer is available. Plug in, open Finder or iTunes, and attempt a backup before wiping. 3: If you can't back up, sign in to iCloud on another device and confirm the last backup date for this phone. If a recent backup exists, the erase will hurt less. 4: Force recovery mode with the buttons for your model, connect to the computer, and choose Restore. 5: Set up as new or restore from backup, then create a new passcode. 6: Verify: the phone unlocks with the new PIN, and your Apple Account is signed in. Check that messages and photos match the backup date.

Failure check: if the phone kicks out of recovery mode, try a different cable and port, and repeat the exact button pattern. If several attempts fail, a service visit is the sensible stop.

Common causes and what to do

"Forgot Passcode?" is missing. Find My was off, there's no active connection, or the iOS is older. Switch to the on-device Erase option or a computer. Wrong Apple Account password. This is a different problem from the PIN; use Apple's account recovery. Be ready for a wait period. Cable shows no device. Swap the cable or port; some cables are charge-only. Security Lockout keeps repeating. Stop guessing—each wrong try increases the delay. Reset instead. Carrier or eSIM issues after erase. On iOS 16 or earlier, get a QR code from your carrier to reinstall the eSIM; on iOS 17 or later the reset can keep the eSIM.

Protect against the next lockout

Once you're back in, a few minutes of setup pays off. Keep the Apple Account password in a password manager and share access with a trusted recovery contact. Set up iCloud Backup or regular computer backups so the next reset costs you data only up to the last backup, not everything. Choose a 6-digit passcode you'll actually remember, and avoid patterns. If you have multiple devices, signing in on another one can also serve as part of recovery. None of this recovers a lost PIN—but it makes losing one a minor annoyance instead of a disaster.

The bottom line: there's no way to retrieve the original code, and every supported route ends with a fresh passcode. Start with the on-device reset, keep a backup in mind before erasing, and step to a computer only when the lock screen offers no help.