How to Unlock an iPhone
Please take backup of your iTunes before you start.
1. Please make sure that you are running the latest version of iTunes software on your computer. You can check it at http://www.apple.com/itunes/download
The next 2 steps are optional to unlock your iPhone, but these 2 steps will make sure that your iPhone is running the latest operating system software. If you do not have the original carrier SIM card or do not wish to update your firmware, please go to step 4.
2. If you've the SIM card from your original network (the network your iPhone is currently locked to), insert it. Connect your iPhone to your computer using the Dock Connector to USB cable provided with your iPhone.
3. Update your iPhone's software in iTunes (It's running the latest iPhone Operating System or iOS).
4. Insert a SIM card from a new service provider into your iPhone. It doesn't has to be a SIM card from the network you wish to unlock - it can be any valid SIM card from ANY network provider except the network your iPhone is currently locked to.
Inserting Sim - original iPhone
Inserting Sim - iPhone 3G & iPhone 3Gs
Inserting Sim - iPhone 4, iPhone 4s & iPhone 5
5. By inserting new SIM card, connect your iPhone to your computer and wait for iTunes to detect your phone.
6. Once it's been detected, disconnect the iPhone from your computer and wait for 20 seconds or so.
7. Reconnect your iPhone to your computer and wait for iTunes to detect it again.
8. Once your iPhone is detected for 2nd time, the process is completed and your iPhone will be unlocked. After searching for few seconds, you'll see your new carrier logo appear in the top left hand corner on the screen of your iPhone's. This unlock is permanent and you can update your iPhone's firmware at anytime.
If you wish to see the unlock screen below within iTunes to confirm this is an official unlock, simply perform a restore within iTunes and once your iPhone is restored you will be presented with the message "Congratulation's, your iPhone has been unlocked" once the restore has completed.