A method for setting the spacings between the cylinders of an inking unit and a central cylinder of a flexographic printing machine, wherein the inking unit comprises an ink chamber doctor blade, an anilox roller and a format cylinder with a printing plate (7, 8) and wherein the ink chamber doctor blade is positioned on the anilox roller for the transfer of ink onto the surface of the anilox roller, wherein the spacing between the anilox roller and the format cylinder is defined by a first cylinder gap and the spacing between the format cylinder and the central cylinder is defined by a second cylinder gap, and wherein an optical sensor is provided for recording the reflected luminous intensity of that surface of the anilox roller, which is located in relation to the direction of rotation of the anilox roller behind the first cylinder gap and in front of the ink chamber doctor blade, having the following steps: - Reduction of the first cylinder gap as well as detection of that point in dependence on the luminous intensity, at which the anilox roller and the format cylinder begin to come into contact, - Further reduction of the first cylinder gap in dependence on the luminous intensity up to the value provided B, in which the printing plate (7, 8) is completely in contact with the anilox roller, but is not pinched together, - Reduction of the second cylinder gap, wherein the roller packet consisting of anilox roller and format cylinder is positioned on the central cylinder while maintaining the optimized relative position, as well as detection of that point in dependence on the luminous intensity, at which the format cylinder and the central cylinder begin to come into contact, - Further reduction of the second cylinder gap, wherein the roller packet consisting of anilox roller and format cylinder is positioned on the central cylinder while maintaining the optimized relative position, up to the value provided D, at which the printing plate (7, 8) is completely in contact with the central cylinder, but is not pinched together, wherein the value provided D is calculated from the already known value provided B. - Reduction of the first cylinder gap as well as detection of that point in dependence on the luminous intensity, at which the anilox roller and the format cylinder begin to come into contact, - Further reduction of the first cylinder gap in dependence on the luminous intensity up to the value provided B, in which the printing plate (7, 8) is completely in contact with the anilox roller, but is not pinched together, - Reduction of the second cylinder gap, wherein the roller packet consisting of anilox roller and format cylinder is positioned on the central cylinder while maintaining the optimized relative position, as well as detection of that point in dependence on the luminous intensity, at which the format cylinder and the central cylinder begin to come into contact, - Further reduction of the second cylinder gap, wherein the roller packet consisting of anilox roller and format cylinder is positioned on the central cylinder while maintaining the optimized relative position, up to the value provided D, at which the printing plate (7, 8) is completely in contact with the central cylinder, but is not pinched together, wherein the value provided D is calculated from the already known value provided B.