If you remember the passcode, go to Settings > Face ID & Passcode or Touch ID & Passcode > Change Passcode
Enter your current passcode
Enter a new passcode
Confirm the new passcode
If you forgot the passcode, put the iPhone into recovery mode
Connect the iPhone to a computer
Open Finder on Mac or iTunes on Windows or older macOS
Select the iPhone when it appears
Choose Restore iPhone
Wait for the restore process to finish
Set up the iPhone again
Restore from a backup if available
If Find My iPhone is enabled, use iCloud.com/find
Sign in with your Apple ID
Select the iPhone
Choose Erase iPhone
Set up the iPhone again
Restore from a backup if available
If you are using iOS 15.2 or later, tap Forgot Passcode? on the lock screen if available
Follow the on-screen steps to erase the iPhone
Sign in with your Apple ID
Set up the iPhone again
If you cannot access your Apple ID, contact Apple Support
