Method for aligning workpieces using a device for processing workpieces which preferably consist at least partly of wood, wood-based materials, plastic or the like, wherein the device comprises: a conveyor device for transporting the workpieces in a conveying direction; an electronic, optical detection device for detecting a position of a three-dimensional structure of the workpieces transported on the conveyor device, wherein the structure is arranged between a first narrow surface of the workpiece and a second narrow surface of the workpiece which limit the workpiece laterally in the conveying direction; and a first alignment device for moving and aligning the workpieces transported on the conveyor device on the basis of a detection result of the detection device, wherein the first alignment device has a first alignment element that can be moved transversely to the conveying direction; and a processing device for processing the first and/or second narrow surface of the workpiece (6, 7) which has at least one first processing means downstream of the first alignment element, wherein the method comprises the steps: transporting a workpiece by means of the conveyor device; detecting a position of a three-dimensional structure of the workpieces transported on the conveyor device, wherein the structure is arranged on the workpiece between a first narrow surface of the workpiece and a second narrow surface of the workpiece which limit the workpiece laterally in the conveying direction, wherein the three-dimensional structure is a chamfer or rounding pressed in a surface press which is pressed in in such a way that the finished workpieces form a joint when they are laid together, moving and aligning the workpiece transported on the conveyor device transversely to the conveying direction on the basis of the detection result of the detection device, wherein the detection and/or displacement or alignment are carried out while the workpiece is being transported in the conveying direction; processing at least one narrow surface of the workpiece (6, 7). a conveyor device for transporting the workpieces in a conveying direction; an electronic, optical detection device for detecting a position of a three-dimensional structure of the workpieces transported on the conveyor device, wherein the structure is arranged between a first narrow surface of the workpiece and a second narrow surface of the workpiece which limit the workpiece laterally in the conveying direction; and a first alignment device for moving and aligning the workpieces transported on the conveyor device on the basis of a detection result of the detection device, wherein the first alignment device has a first alignment element that can be moved transversely to the conveying direction; and a processing device for processing the first and/or second narrow surface of the workpiece (6, 7) which has at least one first processing means downstream of the first alignment element, wherein the method comprises the steps: transporting a workpiece by means of the conveyor device; detecting a position of a three-dimensional structure of the workpieces transported on the conveyor device, wherein the structure is arranged on the workpiece between a first narrow surface of the workpiece and a second narrow surface of the workpiece which limit the workpiece laterally in the conveying direction, wherein the three-dimensional structure is a chamfer or rounding pressed in a surface press which is pressed in in such a way that the finished workpieces form a joint when they are laid together, moving and aligning the workpiece transported on the conveyor device transversely to the conveying direction on the basis of the detection result of the detection device, wherein the detection and/or displacement or alignment are carried out while the workpiece is being transported in the conveying direction; processing at least one narrow surface of the workpiece (6, 7). transporting a workpiece by means of the conveyor device; detecting a position of a three-dimensional structure of the workpieces transported on the conveyor device, wherein the structure is arranged on the workpiece between a first narrow surface of the workpiece and a second narrow surface of the workpiece which limit the workpiece laterally in the conveying direction, wherein the three-dimensional structure is a chamfer or rounding pressed in a surface press which is pressed in in such a way that the finished workpieces form a joint when they are laid together, moving and aligning the workpiece transported on the conveyor device transversely to the conveying direction on the basis of the detection result of the detection device, wherein the detection and/or displacement or alignment are carried out while the workpiece is being transported in the conveying direction; processing at least one narrow surface of the workpiece (6, 7).