If you forgot your iPhone passcode, you must erase the device to remove the passcode
If you have a computer, 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 your iPhone when it appears
Choose Restore when prompted
Wait for the restore to finish
Set up the iPhone again
Restore your data from an iCloud or computer backup if available
If you do not have a computer, use iCloud Find My to erase the iPhone
Sign in to iCloud.com/find
Select your iPhone
Choose Erase iPhone
Set up the iPhone again after erasing
If Activation Lock appears, sign in with the Apple ID previously used on the device
If you cannot access your Apple ID, use Apple Support or account recovery
If your iPhone is disabled, repeat the erase and restore process
Keep your Apple ID and password ready before starting
