An apparatus for forming groups of products, comprising: - an inlet line (14) arranged to advance individual products (P) aligned along a first direction (X), - a conveyor (18) having a plurality of seats (20) for receiving respective products (P) from said inlet line (14) and movable along a second direction (Y) orthogonal to said first direction (X), - an extractor element (28) movable cyclically along an extraction direction (A) parallel to said first direction (X) and arranged to extract a first and a second group of products (G) from said conveyor (18) at each cycle, and - at least one compacting device (30, 32) comprising a fixed central wall (34, 44) and two side walls (36, 46) movable cyclically with respect to the central wall (34, 44) between an open position and a closed position, wherein said side walls (36, 46) and said fixed wall (34, 44) define two compacting zones (37, 47) for receiving respective groups of products (G) from said conveyor (18), wherein said side walls (36, 46) compact said groups of products (G) against the central wall (34, 44) during movement from the open position to the closed position.