The cooling power of cryocoolers is determined by the work done by the compressor and the entropy produced by the irreversible processes in the various components of the system. In this paper we discuss the thermodynamics of pulse tubes, but many of the relationships are equally valid for other cryocoolers such as Stirling or Gifford-McMahon coolers. First general equations will be derived staying as close as possible to first principles, i.e. the first and second law of thermodynamics. General estimations of the entropy productions are made and the consequences for the design of coolers are discussed. No assumptions are made with respect to the nature of the gas and the relationships are valid for large pressure variations. Much attention ...