Battle of Magenta, (June 4, 1859), engagement between France and Austria in the Franco-Piedmontese war during the second war of Italian independence (1859–61). French ruler Emperor Napoleon III had allied himself with the kingdom of Piedmont, intending to drive the Austrians out of northern Italy. Moving 130,000 men to Italy by train-the first mass movement of troops by railroad-Napoleon III then ran into a chaotic encounter with the Austrians at Magenta. The outcome was a narrow French victory. The scene of the fighting was Magenta, 12 miles (19 km) west of Milan, in Austrian-dominated northern Italy.

An early offensive by the Austrians against Piedmont, before the kingdom was supported by the French, might have given them some sort of victory. Prevarication prevented this, and the Austrian armies withdrew to the Ticino River and took up defensive positions. As the French approached on June 4, the Piedmontese should have supported them, but their commanders were also hesitant and the French fought alone. The latter managed to establish bridgeheads across the river, over hastily built pontoon bridges in the north, and at San Martino across a bridge that the Austrians had intended to destroy but only damaged. Around San Martino the fighting was fierce, even desperate. French grenadiers found themselves attacked repeatedly by Austrian columns. French reinforcements had to run in sweltering heat to relieve the grenadiers. Given the confined nature of the terrain—divided by rivers, canals, and orchards—it was a battle in which tactics counted for little and large maneuvers were impossible; bayonet, sword, and fighting spirit predominated.

It seemed that the battle had ended for the day. However, to the north, French troops under General MacMahon, which initially had been repulsed, rallied and assaulted the town of Magenta. Every building had been fortified and manned by sharpshooters, and each house had to be cleared in a series of bloody encounters. Finally the town fell, and the Austrian army retreated. Four days later, Napoleon III and Piedmontese king Victor Emmanuel made a triumphal entry into Milan. The political result of the Austrian defeat was that, beginning with Bologna on June 12, many districts and cities rose against Austrian rule and joined the cause of Italian unity.

Losses: French, more than 4,500 dead or wounded of 54,000; Austrian, 5,700 dead or wounded, 4,500 captured of 58,000.