If you forgot your iPhone passcode, you must erase the iPhone to remove it
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
Wait for the erase and restore process to finish
Set up the iPhone again
Restore from an iCloud or computer backup if available
If Find My iPhone is enabled, erase the iPhone using iCloud.com or the Find My app
If you remember the passcode and want to change it, go to Settings
Tap Face ID & Passcode or Touch ID & Passcode
Enter the current passcode
Tap Change Passcode
Enter the old passcode
Enter the new passcode
