A Flat-12 is an internal combustion engine in Flat configuration, having 12 cylinders.

The flat-12 is larger than a V12 and has no advantage in terms of vibrations. Thus the design is rarely used on production cars.

Most of the flat-12 engines are not true piston-opposed engines (boxer) but rather 180° V engines. The real boxer has one crank pin per piston while in the 180° V engine two pistons share the same crank pin. With twelve cylinders both layouts are perfectly balanced.

It was used in Formula One and Endurance racing, the flat-engine concept had the advantage of a low center of gravity. When wing-cars requiring air-flow venturies came along in the late 1970s, the wide flat-layout obstructed the airflow and became obsolete.

In 1964-65, at the end of the 1.5 litre F1 era, Ferrari introduced a flat-12 on the Ferrari 1512, but a more classical V12 was chosen for the new 3 litre F1.

The Porsche 917 endurance racing car (introduced in 1968, for the Sport category) was powered by an air-cooled flat-12. This engine was a direct evolution of the Porsche flat-8 design.

The domination of the Porsche 917 over the V12-powered Ferrari 512 probably influenced Ferrari, for they returned to the flat-12 in 3 litre water-cooled form for its prototypes and Formula One cars.

The Ferrari flat-12 design was successful and influential especialy on Italian manufacturers, Alfa-Romeo was also successful in endurance with a flat-12 while the Tecno Formula One flat-12 was a failure.

A 5 litre flat-12 was later introduced by Ferrari on some of its production models, including the Berlinetta Boxer and Testarossa.