If you know your current iPhone passcode, you can change it in Settings. If you forgot the passcode and are locked out, you generally cannot simply replace it without erasing or resetting access to the device.
Steps
- If you know the current passcode, open Settings > Face ID & Passcode or Touch ID & Passcode.
- Enter the current passcode and tap Change Passcode.
- Enter the old passcode again, then create and confirm the new one.
- If you are locked out because the passcode was forgotten, follow Apple’s recovery or reset options shown on the device instead of repeatedly guessing.
Changing the device passcode is separate from changing your Apple Account password or Screen Time passcode. Make sure you are resetting the credential that is actually causing the problem.
If the iPhone is unavailable and no supported recovery option works, Apple’s standard forgotten-passcode process may require you to erase the device and setting it up again. You can then restore a compatible backup if one is available.