This a very common question and like many things to do with the human body there are some simple answers that suffice in most cases but some complexity if you dig a bit deeper.
Ice can numb small nerve endings and relieve pain. It may also decrease the small amount of bleeding that occurs in the first day or two following an injury like a muscle tear or ligament sprain. Ice is best used in the first few days following an injury but can be used other times as long as it is giving you pain relief.
Heat relaxes muscles, improves circulation and soothes aches and mild pain. Heat should not be used in the first few days following a muscle tear or ligament sprain as it can increase inflammation and swelling. Most people find heat more comfortable than ice and it may make you feel less stiff. In some cases when pain is very intense, heat doesn’t always give enough pain relief to everyone. In these cases you can try ice as long as the ice doesn’t make the pain more intense.
How long should you apply ice? This depends on the size and thickness/depth of the body part you are try to cool and what you are using as your ice pack. In a small area that is not very thick and close to the surface you may only need a few minutes to cool it down. In a large muscle that is quite deep you will often need to keep the ice on longer. If you are using a very cold, commercial gel ice pack or a large amount of ice cubes it will cool the tissue faster. If your using frozen peas or a gel pack that isn’t that cold you may need to keep it on longer. Always have a layer of dry cloth or paper towel between the ice and your skin to avoid “ice burn”. Take the ice off after a few minutes and check how cool the skin is getting to determine how long you may need to keep it on. Ice is generally not comfortable but it should not cause intense pain and if it is you should remove it and let the tissue warm up again. In most cases icing between 7-20 minutes is a good range depending on the variables discussed above.
Some of the same prinicples can be applied to using heat. Check your skin after a few minutes and do not let it get painfully hot. Keeping a comfortable level of heat on a body part for 15-30 minutes is appropriate in most cases.
If you have any problems with your ability to accurately sense heat or cold and/or circulation problems such as Raynaud’s you need to be extra careful using ice or heat and check your skin more frequently.
To summarize, if you feel you have actually sustained a new injury like a muscle tear or ligament sprain that is producing alot of inflammation and swelling, only use ice and avoid heat for the first few days. Don’t apply ice directly to bare skin. Check your skin after a few minutes of applying ice or heat to make sure it is not too cold or hot. If it is not an acute injury you can use either heat or ice, whichever gives you the most pain relief and allows you to move easier. Everyone is different so do what works best for you.