If you know the passcode, go to Settings > Face ID & Passcode or Touch ID & Passcode > Change Passcode
If you forgot the 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 to erase the iPhone and remove the passcode
Set up the iPhone again after restoration
Restore from an iCloud or computer backup if available
If Find My iPhone is enabled, erase the device from iCloud.com or the Find My app
If needed, contact Apple Support or visit an Apple Store
