Open the Settings app
Tap Face ID & Passcode or Touch ID & Passcode
Enter your current passcode
Tap Change Passcode
Enter your current passcode again
Enter a new passcode
Re-enter the new passcode to confirm
If you forgot your passcode, put the iPhone into recovery mode
Connect the iPhone to a Mac or PC
Open Finder on Mac or iTunes on Windows or older macOS
Select the iPhone when it appears
Choose Restore iPhone
Set up the iPhone again after it erases
Restore from a backup if available
If prompted for Apple ID after erase, enter the Apple ID and password used on the device
