In a closed system, no mass may be transferred in or out of the system boundaries. The system always contains the same amount of matter, but (sensible) heat and (boundary) work can be exchanged across the boundary of the system. Whether a system can exchange heat, work, or both is dependent on the property of its boundary.
* Adiabatic boundary – not allowing any heat exchange: A thermally isolated system
* Rigid boundary – not allowing exchange of work: A mechanically isolated system
One example is fluid being compressed by a piston in a cylinder. Another example of a closed system is a bomb calorimeter, a type of constant-volume calorimeter used in measuring the heat of combustion of a particular reaction. Electrical energy travels across the boundary to produce a spark between the electrodes and initiates combustion. Heat transfer occurs across the boundary after combustion but no mass transfer takes place either way.
The first law of thermodynamics for energy transfers for closed system may be stated:
where denotes the internal energy of the system,  heat added to the system,  the work done by the system. For infinitesimal changes the first law for closed systems may stated:
If the work is due to a volume expansion by  at a pressure  then:
For a quasi-reversible heat transfer, the second law of thermodynamics reads:
where  denotes the thermodynamic temperature and  the entropy of the system. With these relations the fundamental thermodynamic relation, used to compute changes in internal energy, is expressed as:
For a simple system, with only one type of particle (atom or molecule), a closed system amounts to a constant number of particles. For systems undergoing a chemical reaction, there may be all sorts of molecules being generated and destroyed by the reaction process. In this case, the fact that the system is closed is expressed by stating that the total number of each elemental atom is conserved, no matter what kind of molecule it may be a part of. Mathematically:
where  denotes the number of -type molecules,   the number of atoms of element  in molecule , and   the total number of atoms of element   in the system, which remains constant, since the system is closed. There is one such equation for each element in the system.