If you know the Apple ID and password, go to iCloud.com/find and erase the iPhone remotely
If the iPhone is disabled or locked, put it into Recovery Mode
Connect the iPhone to a Mac or PC with a USB cable
Open Finder on Mac or iTunes on Windows or older macOS
Keep the iPhone in Recovery Mode until the computer detects it
Choose Restore when prompted
Wait for the restore process to finish
If the iPhone uses Activation Lock, sign in with the Apple ID previously used on the device after reset
If you do not know the Apple ID or password, contact Apple Support with proof of purchase
