IPhone 4, how to delete everything and unlock it to sell?

I'm selling my phone, and I was just wondering, how can I unlock it to all networks, and delete everything on it, so it is just like a new iPhone, but can be used on any and all networks. Thanks anybody who answers, I really appreciate it.

You can restore your iPhone with iTunes, it will delete everything on iPhone, turn it into factory setting.

You can set the phone delete everything if you guess the pass code wrong enough times, but i don't know how to unlock it…

Restore it to default using iTunes. That's it. Make sure to do a backup before doing this.

You can restore the I-phone 4 it will delete everything in the phone. This is Restore to factory settings. You can Unlock I-Phone 4 easily using the Remote Unlock service… Visit the site http://www.onlinegsmunlock.com/apple-iphone-4/rs7wp9/ get the Remote Unlock service and Unlock it easily… Then use with other GSM Network sim card. You can specify the network and country it's locked now and get the Remote unlock service here to unlock it.

Go to "Settings" -> "General" -> "Reset". Select "Erase All Content and Settings" and tap "Erase iPhone".

You can Factory Unlock it online.