Components of Recessed Lights
The lamp housing, commonly referred to as the can, only gets hot when the bulb is in use. The small box on the top of the can, however, contains wiring and components; in most models this box generates its own heat. It is entirely possible to prevent the can walls from becoming hot simply by using a low-wattage incandescent bulb or a bulb designed to produce little heat, but most connection boxes will still become hot.
National Electric Code
The National Electric Code is a publication that supplies standards for safe installation of electrical systems and appliances. The NEC is not a legally binding code but is often adopted by states and municipalities as a practical standard within their jurisdictions. Article 410 of the code deals with fixtures. Part XI addresses flush and recessed fixtures, and subsection 116 (a) (1) notes, “A fixture that is not identified as an IC fixture must be installed so that all recessed parts are not in contact with combustible material." The code adds, "A 1/2-inch space must be maintained from any combustible material.” In this context, “IC” means a type of fixture that dissipates air rapidly and therefore does not require that free air space surrounding it.
Because all makes and models of recessed lighting have different properties and because the type and wattage of the bulb to be used is an unknown quantity, it is not possible to give a blanket value for how close a light can be to framing. Each light should be supplied with installation instructions from the manufacturer, and these should give exact values. That said, a fairly standard recessed light should not be fitted so that any part of its assembly is less than half an inch from anything flammable -- such as a timber joist -- at the sides. A two-inch clearance from anything above the lamp is a typical minimum. Insulation, both loose-fill and batt, should be kept at least three inches away.
Further, municipal code may mandate minimum safe distances; the local code enforcement office should be consulted before installation.
A Further Consideration
There is an additional cause for caution where heating from recessed lighting is concerned. Most recessed lighting is made with hanger bars and a pigtail of heat-resistant wire; this wire is intended to be joined to the Romex supply in a junction box away from the lamp. Some lower-end models are sold without the hanger bar and pigtail, and it can be tempting to wire these directly to the Romex power supply. This practice is not advised. Romex thermoplastic-covered wire is not designed to be installed close to a heat source.