In thermodynamics, heat is a type of energy transfer in which energy flows from a warmer substance or object to a colder one. It can be defined as the total amount of transferred energy excluding any macroscopic work that was done and any transfer of part of the object itself. Transfer of energy as heat can occur through direct contact, through a barrier that is impermeable to matter (as in conduction), by radiation between separated bodies, by way of an intermediate fluid (as in convective circulation), or by a combination of these. By contrast to work, heat involves the stochastic (random) motion of particles (such as atoms or molecules) that is equally distributed among all degrees of freedom, while work is confined to one or more specific degrees of freedom such as those of the center of mass.
Since heat (like work) is a quantity of energy being transferred between two bodies by certain processes, neither body “has” a definite amount of heat (much like a body in itself doesn’t “have” work). In contrast, a body indeed has properties (state functions) such as temperature and internal energy. Energy exchanged as heat during a given process changes the (internal) energy of each body by equal and opposite amounts. The sign of the quantity of heat indicates the direction of the transfer, for example from system A to system B; negation indicates energy flowing in the opposite direction.
Although heat flows spontaneously from a hotter body to a cooler one, it is