A dyeing machine for dyeing a mass of yarn or textile fiber, such as in the form of spools, spindles, beams, cops, clews, skeins, tops, muffs, which comprises a closed tank which is adapted to be filled at least partly with a treatment fluid so as to form a treatment bath, and recirculation means (8, 20) which are connected to said closed tank in order to move the treatment fluid between the inside and the outside of said closed tank, said closed tank comprising internally at least one spool-supporting rod on which it is possible to fit said mass of yarn or textile fiber, so that, during an operative condition, an amount of said treatment bath is retained by absorption by the yarn or textile fiber of said mass and the remaining second portion of said treatment bath remains outside said mass, said at least one spool-supporting rod being adapted to allow at least a first portion of the treatment bath, which corresponds to said amount of treatment bath that is retained by absorption by the yarn or textile fiber of said mass, to pass transversely through said mass, said recirculation means comprising: - a first pump, which is associated with a first hydraulic circuit which passes through said at least one spool-supporting rod, - a second pump, which is associated with a second further hydraulic circuit which passes through the outside of said closed tank; characterized in that it comprises a control system configured to control said first and second pumps, in said operative condition wherein said mass is fitted on said least one spool-supporting rod and both said first and second pumps are pumping, so that: said first pump has a flow rate that is such as to exchange said first portion of the treatment bath, corresponding to said amount of treatment bath that is retained by absorption by said mass, a preset number of times per unit of time, and said second pump has a flow rate that is such as to make said second portion of the treatment bath exit from the closed tank and return it into the closed tank, so as to mix said treatment bath. said closed tank comprising internally at least one spool-supporting rod on which it is possible to fit said mass of yarn or textile fiber, so that, during an operative condition, an amount of said treatment bath is retained by absorption by the yarn or textile fiber of said mass and the remaining second portion of said treatment bath remains outside said mass, said at least one spool-supporting rod being adapted to allow at least a first portion of the treatment bath, which corresponds to said amount of treatment bath that is retained by absorption by the yarn or textile fiber of said mass, to pass transversely through said mass, said recirculation means comprising: - a first pump, which is associated with a first hydraulic circuit which passes through said at least one spool-supporting rod, - a second pump, which is associated with a second further hydraulic circuit which passes through the outside of said closed tank; - a first pump, which is associated with a first hydraulic circuit which passes through said at least one spool-supporting rod, - a second pump, which is associated with a second further hydraulic circuit which passes through the outside of said closed tank; said first pump has a flow rate that is such as to exchange said first portion of the treatment bath, corresponding to said amount of treatment bath that is retained by absorption by said mass, a preset number of times per unit of time, and said second pump has a flow rate that is such as to make said second portion of the treatment bath exit from the closed tank and return it into the closed tank, so as to mix said treatment bath.