What If I Forget My iPhone’s Passcode?
Well that’s not good. Really there’s only one solution (that can be approached a few different ways). You’ll need to factory restore your iPhone, and then restore it from a back up.
If you’re not already backing up your iPhone, now is a good time to start. You can back up your device to a computer or by using iCloud Backup.
While iCloud is the most convenient option, you’ll need to have enough storage space for the backup. If you need more than 5 GB, you’ll need to pay to upgrade your plan.
You can erase the device using iTunes, Find My iPhone, or, if all else fails, recovery mode.