A gluing device for a box forming machine and configured to apply liquid glue to a flat blank of paper or cardboard having a base and a plurality of segments connected to the base and foldable to form a box sidewall, where the free sides of the segments, designed to be joined to form the edges of the box sidewall, are bevelled to define oblique faces contained in the thickness of the segments, comprising: - a supporting structure configured to enable the blank to move in a feed plane along a longitudinal feed direction to convey it to a gluing station; - at least one liquid glue dispensing nozzle movable along a predetermined direction parallel to the feed plane in such a way as to spread the glue on one or more of the oblique faces, wherein the supporting structure comprises: - positioning means operating on the blank to move it to a predetermined longitudinal position in the gluing station; - locking means operating on the blank in order to hold the blank in place in the same plane as the feed plane, while it is in the predetermined longitudinal position, wherein the supporting structure further comprises a first and a second guide positioned longitudinally in the feed plane and shaped in such a way as to prevent transversal movements of the blank and to slidably support lateral end portions of segments of the blank, wherein the locking means include jaws which are movable between an open position, of non-interference with the blank, and a closed position, wherein the jaws, in the closed position, are configured to operate on the blank segments resting on the guides in order to keep them in the feed plane, wherein the jaws are connected to corresponding actuators, characterized in that the actuators are associated with the guides, so that the blank is locked at the predetermined longitudinal position while keeping it in the same plane as the feed plane, through the jaws which are moved between the open position and the closed position, where the jaws operate on the blank segments resting on the guides in order to keep them in the feed plane. - a supporting structure configured to enable the blank to move in a feed plane along a longitudinal feed direction to convey it to a gluing station; - at least one liquid glue dispensing nozzle movable along a predetermined direction parallel to the feed plane in such a way as to spread the glue on one or more of the oblique faces, wherein the supporting structure comprises: - positioning means operating on the blank to move it to a predetermined longitudinal position in the gluing station; - locking means operating on the blank in order to hold the blank in place in the same plane as the feed plane, while it is in the predetermined longitudinal position, - positioning means operating on the blank to move it to a predetermined longitudinal position in the gluing station; - locking means operating on the blank in order to hold the blank in place in the same plane as the feed plane, while it is in the predetermined longitudinal position, wherein the supporting structure further comprises a first and a second guide positioned longitudinally in the feed plane and shaped in such a way as to prevent transversal movements of the blank and to slidably support lateral end portions of segments of the blank, wherein the locking means include jaws which are movable between an open position, of non-interference with the blank, and a closed position, wherein the jaws, in the closed position, are configured to operate on the blank segments resting on the guides in order to keep them in the feed plane, wherein the jaws are connected to corresponding actuators, characterized in that the actuators are associated with the guides, so that the blank is locked at the predetermined longitudinal position while keeping it in the same plane as the feed plane, through the jaws which are moved between the open position and the closed position, where the jaws operate on the blank segments resting on the guides in order to keep them in the feed plane.