- "Dovaogēdys! Āeksia ossēnātās, menti ossēnātās, qilōni pilos lue vale tolvie ossēnātās, yn riñe dōre ōdrikātās. Urnet luo buzdaro tolvio belma pryjātās!
(Unsullied! Slay the masters, slay the soldiers, slay every man who holds a whip, but harm no child. Strike the chains off of every slave you see!)"
- ―Daenerys Targaryen orders the Unsullied to purge Astapor of slavers.
Following her journey from Qarth to Slaver's Bay, Daenerys's dragons have grown to the size of small dogs, not large enough to invade Westeros. She travels to Astapor to acquire the Unsullied, the elite warrior-eunuchs produced in Astapor, regarded as some of the finest soldiers in the world. Despite her reservations about slavery, Jorah convinces her that she has no choice but to settle for this solution since she has no other means of acquiring an army.
The incident is orchestrated by Daenerys, who had previously been faced with the issue of using a slave army to conquer a realm in which slavery had been outlawed and reviled for centuries. Having observed the suffering of Astapor's slaves, Daenerys devises a plan to acquire all of Astapor's Unsullied and turn on the Good Masters. She offers one of her dragons in exchange for all of the Unsullied, as her ship and gold weren't enough for the Good Masters. Kraznys mo Nakloz insults Daenerys repeatedly in his native tongue; Daenerys does not let on that she actually speaks the language fluently.
Daenerys springs her trap after handing over Drogon. After making sure that the Unsullied are indeed loyal to her as their new master, she orders them to kill the Good Masters and their soldiers, as well as any man in Astapor who holds a whip. She also instructs them to spare all children and strike off the chains of any slave they came across.
The Good Masters are powerless to stop the situation, as the local defenders are not only outnumbered but also inferior to the Unsullied. Furthermore, Kraznys mo Nakloz had assumed that his new dragon would, like a slave, accept its new master. Daenerys reminds him that dragons are not slaves before commanding Drogon to burn the slaver as he frantically calls for his guards to kill her.
The Unsullied perform as promised, the Good Masters are all slain and the local slaves freed. Immediately after the Sack is completed Daenerys frees the Unsullied as well. They, however, opt en masse to continue their service to her as free men and depart Astapor with her.
Daenerys leaves Astapor in the hands of a council of former slaves to rule in her stead as she goes on to take Yunkai and Meereen. However, the council is soon overthrown by a butcher named Cleon who seizes control of the city and styles himself as "His Imperial Majesty".
In the books
In the A Song of Ice and Fire novels, the Sack of Astapor happens in much the same way, though it begins in the Plaza of Punishment - the novels' equivalent to the Walk of Punishment - because the Plaza of Pride is too small to contain all the Unsullied.
Besides the 8,000 Unsullied, Daenerys' bloodriders as well as the rest of her khalasar take part in the sack of the city, although they might have in the TV series as well – it isn't clear since the Sack itself is depicted off-screen.
Another difference is that Barristan and Jorah were privy to Daenerys' plan: they and the khalasar attack along with Drogon when Daenerys utters dracarys.
Finally, Daenerys orders her forces to spare all children below the age of twelve, while the TV version shortens this to just have her say "harm no child" without specifying an age.