Machine for the cushioning and confinement of objects inside a box made of foldable material, for example of carton and composed of a base of square or rectangular, or approximately square or rectangular shape, and of four side walls inter-connected at right angles forming ridges, this machine featuring tooling for adapting the height of the useful volume of the box to the height of the stack of objects placed into it and for ensuring the closure of said box, and of means for moving said box in order to position it under said tooling, characterized in that this tooling comprises, on the one hand, gripping elements for seizing the upper portion of at least two side walls of the box, and to apply a force directed towards the exterior, on said two upper sections so as to break the connections between said upper sections, and to ensure the tilting towards the exterior of said separated upper sections and, on the other hand, pushing elements for folding the separated upper sections of the side walls back in the direction of the center of the box.