1. If you have an iPhone 3G (second generation, white or black back)
1. If you bought your iPhone DURING or BEFORE December 2008
Have you upgraded the firmware to the latest (2.2.1, or higher, such as the 3.0 beta) via iTunes?
1. NO: You (most likely) have the 5.8 (aka 5.08) bootloader (BL). You can jailbreak it using QuickPwn and unlock it using yellowsn0w (available from Cydia or the Installer.)
2. YES: Your bootloader may have been upgraded to 5.9 or higher.
Follow the instructions (posted elsewhere, or use
THIS wiki) to check your BL version (and do this: ) If, after checking, you find that you have BL 5.8, you got lucky, and the information from bullet 1.1.1 applies.
If you find that you have BL 5.9 (or higher), see item 1.2.1 below.
2. If you bought your iPhone AFTER January 2009
1. You (most likely) have the 5.9 (aka 5.09) or higher bootloader (BL). yellowsn0w will not work on this BL, as the exploit found in 5.8 was closed in 5.9 and higher. You can still jailbreak the phone using QuickPwn, but you cannot use it on another carrier UNLESS you get a SIM adapter.
2. If you have an iPhone 2G (first generation)
o You can upgrade it to the latest firmware, use QuickPwn to jailbreak it, and unlock for use on other GSM carriers.
BOTTOM LINE:
If you have the 5.9 (aka 5.09) or higher bootloader, don't bother posting a question asking how to unlock it (free or otherwise) for use on another carrier besides AT&T! The short answer is YOU CAN'T. The slightly longer answer is that you CAN use it on another carrier IF YOU PURCHASE A SIM ADAPTER (that does NOT "unlock" the iPhone, it merely FOOLS it into thinking whatever SIM you use is a "real" AT&T SIM, even though it's not.) There are many of these available; I'm not endorsing one over the other, but it appears many people have been happy with the one available from unlockediphone.info for $37.95.
And for the people who ask (not as commonly, but I saw a thread posted just yesterday asking this question again), no you cannot use the iPhone on Sprint (CDMA), Verizon (CDMA), AllTel (CDMA), Nextel (iDEN), or MetroPCS (CDMA or in some places TDMA), PERIOD. The iPhone (2G or 3G) is a GSM phone, and thus will only work on a GSM NETWORKS (AT&T, T-Mobile, et. al)