if you forget your iphone passward and want to reset it without any data lost, you can follow the following steps:
Step 1:First you have to Connect iPhone to computer via a USB cable
when you connect your iphone to your computer then follow the following steps.
1) Hold “Home” button & “Power” button at the same time until the device screen turns to black. Wait for atleast 10 seconds.
2) Release “Power” button and keep holding “Home” button for anther 15 seconds.
3) Release “Home” button until you receive the message “Enter DFU mode successfully”.
Step 2: When you launch iTunes, it will automatically sync your device. But if it doesn’t, you need to do it on your own, which means you have to do the following steps: Click “View”> “Show Sidebar”, then your iPhone will be displayed in the left sidebar.
Step 3: When iTunes have synced and backed up your device, please go to “Device” in the sidebar. Then click on Summary tab. Next go to “Restore iPhone” button.
Step 4: Finally, click on “Restore Backup” to restore iPhone from iTunes
backup files and then you can reset your iPhone passcode.
If you have backed up data to iTunes previously, you can use recovery tool to extract data and save them to your computer.