E=mc2 where m stands for rest mass (invariant mass) m0, applies most simply to single particles viewed in an inertial frame where they have no momentum. But it also applies to ordinary objects composed of many particles so long as the particles are moving in different directions so the "net" or total momentum is zero. The rest mass of the object includes contributions from heat and sound, chemical binding energies, and trapped radiation. Familiar examples are a tank of gas, or a hot poker. The kinetic energy of their particles, the heat motion and radiation, contribute to their weight on a scale according to E=mc2.
The formula E=mc^2 is the special case of the relativistic energy–momentum relationship:
This equation gives the rest mass of an object which has an arbitrary amount of momentum and energy. The interpretation of this equation is that the rest mass is the relativistic length of the energy–momentum four-vector.
If the equation E=mc2 is used with the rest mass or invariant mass of the object, the E given by the equation will be the rest energy of the object, and will change according to the object's internal energy, heat and sound and chemical binding energies (all of which must be added or subtracted from the object), but will not change with the object's overall motion (in the case of systems, the motion of its center of mass). However, if a system is closed, its invariant mass does not vary between different inertial observers (different inertial frames), and is also constant, and conserved.
If the equation E=mc2 is used with the relativistic mass of the object, the energy will be the total energy of the object, which is also conserved so long as no energy is added to or subtracted from the object, However, like the kinetic energy, this total energy will depend on the velocity of the object, and is different in different inertial frames. Thus, this quantity is not invariant between different inertial observers, even though it is constant over time for any single observer. As in the case of rest energy, these relationships for total energy are also true for systems of objects, so long as the system is closed.
https://en.wikipedia.org/wiki/Mass–energy_equivalence