Heat pumps work based on the principle of thermodynamics, specifically by transferring heat from one place to another using a refrigerant. The primary purpose of heat pumps is to either heat or cool a specific area, such as a building or a room. The process of heat transfer can be reversed, allowing heat pumps to function both as heating and cooling systems.

The heat pump system begins with the refrigerant in a gaseous state at low pressure and low temperature. This refrigerant is typically a compound with excellent heat-absorbing and heat-releasing properties.
In the heating mode, the heat pump's evaporator coil is located indoors and in the cooling mode, it is located outdoors. When the system is in heating mode, the indoor coil absorbs heat from the surrounding air, water, or ground, depending on the type of heat pump (air-source, water-source, or ground-source heat pump). As the refrigerant absorbs heat, it turns into a low-pressure, low-temperature gas.
The low-pressure refrigerant gas is then compressed by the heat pump's compressor. Compressing the gas increases its temperature and pressure, turning it into a high-temperature, high-pressure gas.
The high-temperature refrigerant gas flows to the condenser coil, which is located outdoors in the heating mode and indoors in the cooling mode. In the heating mode, the outdoor coil releases the heat it gained during compression to the outside air. In the cooling mode, the indoor coil releases heat to the indoor air.
After releasing heat to the surroundings, the refrigerant is passed through an expansion valve, where its pressure is reduced and it changes back into a low-pressure, low-temperature liquid-vapor mixture.
The cycle repeats as the low-pressure liquid-vapor mixture returns to the evaporator coil and the process starts again.
In heating mode, the heat pump transfers heat from the outside (even in cold weather, there is still some heat available) to the inside of a building. In cooling mode, the heat pump functions like an air conditioner, transferring heat from the inside of the building to the outside.