If you know the Apple ID and password, use iCloud Find Devices to erase the iPhone remotely
Go to iCloud.com/find or use the Find My app on another Apple device
Sign in with the Apple ID linked to the locked iPhone
Select the iPhone
Choose Erase This Device
Confirm the erase
If the iPhone is disabled or locked and you do not know the passcode, use Recovery Mode with a computer
Connect the iPhone to a Mac or Windows PC
Open Finder on Mac or iTunes/Apple Devices app on Windows
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 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 the Side or Top button until the recovery screen appears
When prompted on the computer, choose Restore
Wait for the restore to complete
If Activation Lock appears after reset, enter the Apple ID and password previously used on the iPhone
If you cannot remember the Apple ID or password, use iforgot.apple.com to recover the account
If the iPhone is managed by an organization, contact the administrator for the reset process
