You can always try to identify your iPhone model by the exterior design, but the iPhone 3G and iPhone 3Gs look very similar, so this may not always be your best option. The simplest and most effective method for determining the difference between the 3G and 3Gs is to look at the back of the phone. The model is listed below the Apple logo.
See what kind of exterior casing the iPhone has. If it is metal, it is first generation. The 3G and 3Gs have plastic casing. If it is glass and steel with a metal band around the edges, it is fourth generation. The iPhone 4 is also slightly longer and flatter.
Look at the volume buttons. The iPhone 4 has "+' and "-" signs; the other models do not.
Look at the back of the iPhone. If the model is 3G or 3Gs, it will say so below the Apple logo. The first generation will have a serial number.
Look for a SIM case on the right side of an iPhone 4 to determine if it is CDMA or GSM. The GSM model has one; the CDMA model does not.