All electronics generate heat as they operate, and the iPhone is no exception. An iPhone's processor doesn't use as much power as a desktop computer, and so creates less heat, but the heat it does produce has to dissipate away from the processor to prevent overheating. Without room for fans and vents like on a computer, that heat instead flows directly into the iPhone's body, where you can feel it. Unless the phone displays a warning, however, you don't need to worry about it feeling warm to the touch.
Components That Generate Heat
Most of the heat generated by an iPhone comes from its processor, which is responsible for all the computations that run your apps and render graphics. The more power the processor uses, the more heat it generates, so your iPhone gets hotter when you run processor-intensive tasks. Playing a game with 3D-modeled graphics, for example, uses more power and creates more heat than writing notes or listening to music. To cool your phone quickly, quit to the home screen and give the processor a rest.
The iPhone's various wireless radios -- for cell service, for Wi-Fi and for the GPS -- also create heat while in use. The cellular radio in particular has a noticeable impact on the phone's temperature, causing it to get hot while on long calls. Ending the call solves the problem, but as a workaround, consider using a Bluetooth headset so you don't have to hold the hot phone up to your head.
The iPhone's can help lower the phone's temperature. If the phone gets dangerously hot, it will automatically dim or turn off the screen to help stabilize the temperature.
The Battery Charger
Charging a battery generates heat, so your phone might get warmer while plugged in than while running on battery. If the iPhone gets too hot, it automatically stops charging to prevent damage. Charging resumes after the phone cools down.
Safe Operating Temperatures
Apple recommends that you not use your iPhone in ambient temperatures of over 95 degrees Fahrenheit. That doesn't mean your phone will necessarily break if you use it for a few minutes on a 100-degree summer day, but the device might take temperature safety measures such as turning off the screen or displaying a warning. If you have to use your phone in the heat, try to avoid activities that generate the most additional heat, such as games and long calls.
Even when you aren't actively using the phone, Apple suggests keeping it below 113 degrees, so don't leave your iPhone in your car. According to the National Highway Traffic Safety Administration, a parked car can reach more than 110 degrees inside even on a cool 60-degree day.
Temperature Warning Screen
If your iPhone reaches temperatures that could damage its components, even after other automatic protection measures, it locks itself entirely while it cools down. In iOS 6 and above, an overheating iPhone displays the warning message, "iPhone needs to cool down before you can use it."
If the warning screen displays the option to "slide for emergency," it will let you unlock the phone to make an emergency call. Unless there's a real emergency, however, don't risk your iPhone's hardware. Let the device cool off and use it again after the warning disappears.
In addition to normal causes, an iPhone might get too hot due to a hardware malfunction. If your phone displays the temperature warning screen repeatedly, even on cool days, take your phone to Apple for repair. In the meantime, do your best to keep it cool by running less intensive apps, keeping calls short and charging it in colder rooms.