If you own the iPhone and forgot the passcode, use Recovery Mode with a computer
Connect the iPhone to a Mac or Windows PC
Open Finder on macOS Catalina or later
Open iTunes or the Apple Devices app on Windows or older macOS
Put the iPhone into Recovery Mode
On iPhone 8 or later, quickly press and release Volume Up, quickly press and release Volume Down, then press and hold the Side button until the recovery screen appears
On iPhone 7 or iPhone 7 Plus, press and hold the Side button and Volume Down button until the recovery screen appears
On iPhone 6s or earlier, press and hold the Home button and Side or Top button until the recovery screen appears
When prompted, choose Restore
Wait for the computer to erase the iPhone and reinstall iOS
Set up the iPhone again after the restore
If Find My iPhone is enabled, use iCloud Find Devices to erase the iPhone remotely
Sign in to iCloud.com/find with the Apple ID linked to the iPhone
Select the iPhone from the device list
Choose Erase This Device
After erasing, set up the iPhone again
If you do not know the Apple ID or password, contact Apple Support with proof of purchase
If Activation Lock appears after reset, enter the Apple ID and password previously used on the device
If the iPhone is managed by a school or company, contact the organization’s IT administrator
