Order 66, also known as Clone Protocol 66, was a top secret order identifying all Jedi as traitors to the Galactic Republic and, therefore, subject to summary execution by the Grand Army of the Republic. The order was programmed into the Grand Army clone troopers through behavioral modification biochips implanted in their brains, making it almost impossible for the clones to disobey the command to turn against their Jedi Generals. The Kaminoan scientists who designed the clone troopers believed it was only to be used as a contingency protocol against renegade Jedi. In secret, Order 66 was the means by which the Sith intended to bring about the long-awaited fall of the Jedi Order.
During the Clone Wars, the Sith agenda was progressing relatively unnoticed until a premature activation of Order 66 resulted in the death of General Tiplar at the hands of CT-5385 «Tup,» a defective clone whose malfunctioning chip caused him to turn against his Jedi officer. The incident led ARC trooper CT-5555 «Fives» to conduct his own investigation into the matter, believing the incident to be a Separatist plot against the Republic. On the galactic capital Coruscant, however, he learned that the chips conditioned the clones to become hostile against the Jedi. Furthermore, he discovered to an extent Supreme Chancellor Sheev Palpatine’s involvement in the conspiracy and attempted to assassinate him. Fives told what he knew to his Jedi superior Anakin Skywalker, but before the clone could prove it, he was killed by clone shock troopers of the Coruscant Guard.
The plan continued apace for the remainder of the war, although the Jedi High Council had grown increasingly wary of the Chancellor’s motives. In 19 BBY, a group of Jedi Masters sought to arrest Palpatine upon learning his true identity as the Sith Lord Darth Sidious. When their efforts failed, Palpatine used the incident to frame the Jedi Order for treason and, as such, directed the clone army to execute their Jedi commanding officers in accordance with Order 66.
Across the galaxy, thousands of Jedi were killed by their own troops while the Chancellor’s new apprentice, the Sith Lord Darth Vader, led the 501st Legion in a direct assault on the Jedi Temple of Coruscant. With the exception of a few surviving Jedi, such as Grand Master Yoda, Jedi Master Obi-Wan Kenobi, former Padawan Ahsoka Tano and Jedi Knight Kanan Jarrus, the Great Jedi Purge was largely accomplished through the initial activation of Order 66. Even after the initial onslaught, Order 66 still stood, and all Jedi, even people who might be Jedi, were to be killed on sight. Sidious would go on to consolidate his reign as Emperor of the Galactic Empire, ruling for decades until the prophecy of the Chosen One came to pass, marking the end of the Sith’s rule and the restoration of balance in the Force by 4 ABY.