The Dunkirk evacuation, codenamed Operation Dynamo by the British, was the evacuation of Allied soldiers from the beaches and harbour of Dunkirk, France, between May 26 and June 4 1940, when British, French and Canadian troops were cut off by the German army during the Battle of Dunkirk in the Second World War. In a speech to the House of Commons, which has since come to be known as we shall fight on the beaches, Winston Churchill called it the greatest military defeat for many centuries, warning that "the whole root, the core, and brain of the British Army" was stranded in Dunkirk. He hailed their subsequent rescue as a "miracle of deliverance."
On the first day only 7,010 men were evacuated but by the ninth day a total of 338,226 soldiers — 198,229 British and 139,997 French  — were rescued by the hastily assembled fleet of 860 boats. Many of the troops were able to embark from the harbour's protective mole onto 42 British destroyers and other large ships, while others had to wade from the beaches toward the ships, waiting for hours to board, shoulder deep in water. Others were ferried from the beaches to the larger ships, and thousands were carried back to England, by the famous "little ships of Dunkirk", a flotilla of around 700 merchant marine boats, fishing boats, pleasure craft and Royal National Lifeboat Institution lifeboats - the smallest of which was the 15-foot fishing boat, Tamzine, now in the Imperial War Museum - whose civilian crews were called into service for the emergency. The "miracle of the little ships" remains a prominent folk memory in Britain. 
Operation Dynamo took its name from the dynamo room in the naval headquarters below Dover Castle, which contained the dynamo that during World War I provided the building with electricity. It was in this room that British Vice Admiral Bertram Ramsay planned the operation and briefed Winston Churchill as it was underway.
Initial plans called for the recovery of 45,000 men from the British Expeditionary Force within two days, at which time it was expected that German troops would be able to block further evacuation. Only 25,001 men escaped during this period, including 7,001 on the first day. Ten additional destroyers joined the rescue effort on May 26 and attempted rescue operations in the early morning, but were unable to closely approach the beaches, although several thousand were rescued. However, the pace of evacuation from the shrinking Dunkirk pocket steadily increased.
On May 29, 47,000 British troops were rescued in spite of the first heavy air attack from the Luftwaffe in the evening. The next day, an additional 54,000 men were embarked, including the first French soldiers. 68,000 men and the commander of the BEF, Lord Gort, evacuated on May 31. A further 64,000 Allied soldiers departed on June 1, before the increasing air attacks prevented further daylight evacuation. The British rearguard departed the night of June 2, along with 60,000 French soldiers. An additional 26,000 French troops were retrieved the following night before the operation finally ended.
Two French divisions remained behind to protect the evacuation. Though they halted the German advance, they were soon captured. The remainder of the rearguard, largely French, surrendered on June 3, 1940. The next day, the BBC reported, "Major-General Harold Alexander [the commander of the rearguard] inspected the shores of Dunkirk from a motorboat this morning to make sure no-one was left behind before boarding the last ship back to Britain."
Number of men rescued (in chronological order):
See main article: Little ships of Dunkirk. Most of the "little ships" were private fishing boats and pleasure cruisers, but commercial vessels also contributed, including a number from as far away as the Isle of Man and Glasgow. Guided by Naval craft across the channel from the Thames Estuary and Dover, these smaller vessels were able to move in much closer to the beaches, and acted as shuttles between the shore and the destroyers, lifting troops who were queuing in the water, some of whom stood shoulder-deep for many hours to board the larger vessels.
Thousands of soldiers were taken in the little ships back to England. Sundowner, for example, owned by Charles Lightoller, former second officer of the Titanic, was requisitioned by the Admiralty on May 30, 1940, Lightoller insisting that if anyone was going to take her to Dunkirk, it would be him and his eldest son, Roger, together with Sea Scout Gerald Ashcroft. The men carried 130 soldiers back to Ramsgate, reportedly packed together like sardines, almost capsizing when they reached the shore. Another boat, Bluebird of Chelsea, a yacht originally owned by Sir Malcolm Campbell, holder of the world land speed record, made two round trips to England, carrying hundreds of men. 
The term "Dunkirk spirit" still stands for a belief in the solidarity of the British people in adversity.
Despite the success of this operation, all the heavy equipment and vehicles were abandoned and several thousand French troops were captured in the Dunkirk pocket. Six British and three French destroyers were sunk, along with nine large boats. In addition, 19 destroyers were damaged. Over 200 of the Allied sea craft were sunk, with an equal number damaged. Winston Churchill revealed in his volumes on World War II that the Royal Air Force played a most important role protecting the retreating troops from the Luftwaffe. Without the support of the RAF, the allies would not have had such a successful evacuation. Churchill also said that the sand on the beach softened the explosions from the German bombs. The RAF lost 145 planes, compared with 132 for the Luftwaffe. However, the retreating troops were largely unaware of this vital assistance because the weather was too foggy to see them, and many bitterly accused the airmen of doing nothing to help. The French also lost a large number of ships that had nothing to do with the evacuation. Many French naval ships were idle in ports. To stop the Germans from being able to use these ships, British bomber planes were sent in to destroy the French ships.
The Royal Navy's most significant losses in the operation were six destroyers:
The French Navy lost three destroyers:
Before the operation was completed, the prognosis had been gloomy, with Winston Churchill warning the House of Commons to expect "hard and heavy tidings". Subsequently, Churchill referred to the outcome as a "miracle", and the British press presented the evacuation as a "Disaster Turned To Triumph" so successfully that Churchill had to remind the country, in a speech to the House of Commons on 4 June, that "we must be very careful not to assign to this deliverance the attributes of a victory. Wars are not won by evacuations." Nevertheless, exhortations to the "Dunkirk spirit" - a phrase used to describe the tendency of the British public to pull together and overcome times of adversity - are still heard in Britain today.
The rescue of the British troops at Dunkirk provided a psychological boost to British morale which ended any possibility that the British would seek peace terms from Germany, since they retained the ability to defend themselves against a possible German invasion. Most of the rescued British troops were assigned to the defence of Britain. Once the threat of invasion receded, they were transferred overseas to the Middle East and other theatres, and also provided the nucleus of the army which returned to France in 1944. Several high rank German commanders (e.g., Generals Erich von Manstein and Heinz Guderian, as well as Admiral Karl Dönitz) considered the failure of the German High Command to order timely assault on Dunkirk and destruction of the British Expeditionary Force to be one of the major mistakes the Germans had made in the Western Theatre, others including the failures to capture Malta and Gibraltar.
The more than 100,000 evacuated French troops were quickly and efficiently shuttled to camps in various parts of south-western England where they were temporarily lodged before being repatriated. British ships ferried French troops to Brest, Cherbourg and other ports in Normandy and Brittany, although only about half of the repatriated troops were deployed against the Germans before the armistice.
In France, the perceived preference of the Royal Navy for evacuating British forces at the expense of the French led to some bitter resentment. The French Admiral Darlan originally ordered that the British forces should receive preference, but Churchill intervened at a May 31 meeting in Paris to order that the evacuation should proceed on equal terms and the British would form the rearguard. A few thousand French forces eventually surrendered, but only after the evacuation effort had been extended for a day to bring 26,175 Frenchmen to Britain on June 4.
For every seven soldiers that escaped through Dunkirk, one man was left behind as a prisoner of war (POW). The majority of these prisoners were sent on forced marches into Germany. Prisoners reported brutal treatment by their guards, including beatings, starvation and murder. In particular, the British prisoners complained that French prisoners were given preferential treatment. Another major complaint was that German guards kicked over buckets of water that had been left at the roadside by French civilians. Many of the prisoners were marched to the town of Trier, with the march taking as long as 20 days. Others were marched to the river Scheldt and were sent by barge to the Ruhr. The prisoners were then sent by rail to POW camps in Germany. The majority then worked in German industry and agriculture for five years. 
The very significant loss of military equipment abandoned in Dunkirk reinforced the financial dependence of the British government on the United States.
The St George's Cross flown from the jack staff is known as the Dunkirk jack, and is only flown by civilian ships and boats of all sizes which took part in the Dunkirk rescue operation in 1940. The only other ships permitted to fly this flag at the bow are those with an Admiral of the Fleet on board.