1003+ Stories from Ancient India — Free to Read! Explore all stories →

Ali Baba and the Forty Thieves

The world-famous orphan tale of the Thousand and One Nights: a poor woodcutter, the magic words Open Sesame, forty robbers, and the quick-witted servant Morgiana who outwits them all.

Origin: One Thousand and One Nights (Arabian Nights) — added to Antoine Galland's French translation in 1712, reportedly from Syrian storyteller Hanna Diab. Part of the 'orphan tales' without early Arabic manuscript sources.
Ali Baba and the Forty Thieves - Indian Folk Tales
Ad Space (header)

Few phrases from any story on earth have travelled as far as two words spoken to a rock face: “Open Sesame.” They have become a byword for any password, any sudden access, any door that swings wide for those who know the secret. Yet the tale that gave the world those words — the story of a poor woodcutter, his greedy brother, forty robbers, and a quick-witted servant girl — is, like its companion Aladdin, one of the great surprises of the Thousand and One Nights: a tale with a known teller and a documented birth, almost certainly never part of the old Arabic Nights at all. Beneath the cave of gold and the famous magic words, it is a careful study of two appetites — contentment and greed — and of how often, in the end, the cleverest person in the room is the one nobody thought to count.

Origin & Canonical Attribution

  • Collection: Alf Layla wa-Layla (الف ليلة وليلة) — the Thousand and One Nights, known in English as the Arabian Nights.
  • This tale: Ali Baba and the Forty Robbers (Antoine Galland, Les Mille et Une Nuits); Ali Baba and the Forty Thieves, or the Forty Thieves Killed by One Slave (Sir Richard Burton, Supplemental Nights).
  • An “orphan tale”: Ali Baba appears in no Arabic manuscript of the Nights known to predate Galland. It is one of the small group scholars call the contes orphelins — the orphan tales — that reached print first in French (alongside Aladdin), in the later volumes of Galland’s Les Mille et Une Nuits completed in the 1710s.
  • The teller: Galland’s diary records that in 1709, in Paris, a series of tales was told to him by a young Maronite Christian traveller from Aleppo, Antun Yusuf Hanna Diyab (born c. 1688), whom Galland had met through the French traveller Paul Lucas. Diyab recounted some fourteen stories from memory; Galland used several, Ali Baba among them. Galland’s journal was rediscovered only in 1881, and Diyab’s own travel memoir surfaced in the Vatican Library and was published in modern times — which is why the storyteller’s name was lost for so long.
  • The forged “source”: an Arabic manuscript of Ali Baba once held at the Bodleian Library in Oxford was long treated as the tale’s original; scholars (notably Muhsin Mahdi) later judged it a back-translation made from Galland’s French, not an older independent text.
  • Translators: Antoine Galland (French, 1704–17); Edward William Lane (1838–40); John Payne; Sir Richard Francis Burton (Supplemental Nights, 1886–88).
  • Tale type: ATU 954, “The Forty Thieves (Ali Baba),” in the Aarne–Thompson–Uther index. Key motifs include the mountain that opens to a magic formula (Thompson D1552.2, N455.3, the secret password overheard) and the clever servant who turns the robbers’ trap against them.
  • Public-domain status: the Nights and the Galland, Lane, and Burton translations are long out of copyright and free to retell.

The Woodcutter and the Words in the Forest

In a city of Persia there lived two brothers, sons of a poor father who had left them little to divide. The elder, Cassim, married a wife with money, set himself up with a shop of fine goods, and prospered into a respected merchant. The younger, Ali Baba, married a wife as poor as himself and earned his bread the hard way: every morning he drove three donkeys into the forest, cut wood until his arms ached, and sold the bundles in the town. It was a small life, but Ali Baba carried no envy in it. He asked for enough, and enough was what he had.

One day, deep among the trees, Ali Baba heard a sound that froze him — the drumming of many horses, coming fast. Fearing robbers, he tethered his donkeys, climbed into a thick tree, and hid. A troop of horsemen rode into the clearing below him: forty of them, hard-faced and well armed, and Ali Baba understood at once that these were the brigands whose name the whole region feared. Their captain dismounted, walked to a bare wall of rock at the foot of a hill, and called out in a clear voice: “Open Sesame!” The stone split like a curtain drawn aside. The robbers filed in with their heavy saddle-bags; the captain spoke again — “Close Sesame” — and the rock sealed without a seam. After a time the door opened of itself, the men rode out empty-handed and light, and the captain shut the hill behind them. Only when the last hoofbeat had died did Ali Baba climb down.

A poor Persian woodcutter in an earth-brown tunic and turban stands before a split-open rock face in a forest hillside as golden treasure light pours out, his firewood-laden donkeys beside him

He stood a long while before the silent rock. Then, half in disbelief, he spoke the words himself: “Open Sesame.” The hill obeyed him as readily as it had obeyed the captain. Inside, Ali Baba found not a rough den but a wide, dry, well-lit chamber heaped with the plunder of years — bales of silk, stacked carpets, worked silver, and gold coins lying loose in mounds. A lesser man might have lost his head. Ali Baba did not. He reasoned that the robbers could never miss what they had never counted, and that he would take only what his three donkeys could quietly carry: a few sacks of gold coin, no more. He spoke the closing words, loaded his beasts, hid the gold under firewood so no eye would see it, and went home. His honesty was not weakness; it was the same measured good sense that had kept him content as a poor man. He took what would change his life, and left untouched the hoard that would have ended it.

The Greedy Brother and the Forgotten Word

Ali Baba’s wife, wanting to know not the count but the worth of so much coin, borrowed a measuring-scoop from Cassim’s wife to weigh the gold. The sister-in-law, sharp with curiosity, smeared a little wax inside the scoop before she lent it — and when it came back, a single gold coin had stuck fast to the bottom. Poor woodcutters did not weigh gold; they counted pennies. That night Cassim came to his brother’s house and demanded the truth, and Ali Baba, who had no gift for lies and no wish to quarrel, told him everything: the forest, the forty robbers, the rock, and the words that opened it. He even offered to share the cave itself.

Sharing was not what Cassim wanted. Before dawn he set out alone with ten mules and a train of great chests, meaning to empty the hill in one journey. He found the rock, said “Open Sesame,” and the door obeyed. But inside, the sight of so much wealth undid him. He dragged chest after chest to the entrance, then turned back for more, and more again, until the daylight outside meant nothing to him. When at last he went to leave, he opened his mouth to speak the magic words — and they were gone. “Open Barley!” he cried. “Open Wheat! Open Oats!” He named every grain that grew, and the one grain he needed would not come to his tongue. The rock that answers a calm man does not answer a frightened one. Cassim was still trapped when the forty robbers returned and found him — and the captain, who allowed no man alive to know his door, dealt with the intruder without mercy. Greed had walked Cassim into the treasure; greed had locked the only door behind him.

The wealthy merchant Cassim in a green-and-gold robe panics among heaps of gold coins and jewelled chests inside the sealed treasure cave

When Cassim did not come home, Ali Baba went to the forest and found what the robbers had left. Grieving for a brother who had never been kind to him, he brought the body home in secret and took the dead man’s widow and household under his own roof. To bury Cassim without rousing the whole town’s questions, the family turned to the one person whose wit they trusted — Morgiana, an enslaved girl in Cassim’s house, clever past any price. It was Morgiana who, with quiet cunning, arranged matters so that the neighbours believed only that Cassim had died of an ordinary illness, and the household’s dangerous secret stayed a secret. Already, before she has truly entered the story, the tale has shown its hand: the survival of this family will not turn on the brothers at all. It will turn on her.

Morgiana and the Marked Door

Back at the hill, the robbers found their dead intruder gone. That a body had been carried off meant a second living person knew their secret — and to a band whose whole safety lay in that secret, one loose mouth was a mortal danger. The captain sent his shrewdest man into the town to listen. The spy, by chance, fell into talk with Baba Mustafa, an old cobbler, who let slip that he had lately been led blindfolded to a house and paid well for unusual stitching work. The cobbler could not name the street — but, blindfolded once, he found he could retrace the turns by feel, and so he led the spy to the very door of Ali Baba’s house. The robber marked the door with a stroke of chalk and slipped away to fetch the band.

Morgiana, a clever young servant woman, draws a white chalk mark on a wooden door at dusk while a row of other doors already carries the same identical mark

But Morgiana came to that door soon after on an errand, and her eye missed nothing. A chalk mark, fresh, on her master’s door and on no other — she did not know who had made it, but she knew that a mark singling out one house among many was never made in friendship. She did not raise an alarm. She fetched chalk of her own and, calmly, marked every door up and down the street with the very same stroke. When the forty robbers rode in by night to fall upon the marked house, they found the mark on twenty houses, then forty, identical on every one, and not a man among them could say which door was the right one. The captain, white with fury, had the failed spy put to death and tried again with a second man; Morgiana met the second chalk mark exactly as she had the first. Twice the band’s whole strength had been turned aside, and not by a sword — by a servant girl with a piece of chalk and a mind that worked faster than forty armed men.

The Forty Jars and the Dagger Dance

The captain saw at last that brute numbers would not serve him; he would have to do this himself, and from the inside. He bought nineteen mules and thirty-eight great leather oil-jars. One jar he filled with oil. Into each of the other thirty-seven he put one of his robbers, armed and silent, with orders to wait for his signal in the night. Then, in the dress of an honest oil-merchant, he led his laden mules to Ali Baba’s door and begged a night’s lodging for a weary traveller. Ali Baba, open-handed as ever, welcomed the stranger, fed him, and had the jars set in rows in his courtyard for the night.

It was Morgiana, again, who stood between the household and its death. Late that night her cooking-lamp ran dry of oil, and she went out to the courtyard to draw a little from the merchant’s jars. As she came near the first, a low voice inside it — a robber, mistaking her step for the captain’s — whispered, “Is it time?” A different servant would have screamed. Morgiana answered softly, in a voice like the captain’s, “Not yet — soon,” and passed from jar to jar, and at each one the same whisper, and the same calm answer. So she counted her enemies without their knowing they had been counted. In the one true oil-jar she found oil; she carried it in, set a great cauldron on the fire, and when it boiled she went quietly down the rows and poured into each jar what was needed to end the danger before it could ever be given its signal. By the time the captain crept out to call his men, he had no men to call.

Morgiana stands by night in a stone courtyard before a long row of tall earthenware oil jars, a steaming copper cauldron on a glowing fire beside her

The captain escaped that night with his life and nothing else, and his hatred only hardened. Some while later he returned to the town in yet another disguise — this time as a prosperous merchant named Khwaja Husain — and patiently made himself a friend of Ali Baba’s grown son, and through the son, a welcome guest at Ali Baba’s own table. He came to dine, a dagger hidden in his robe, meaning to kill his host before the meal was done. But Morgiana, carrying in the dishes, knew the guest’s face beneath the merchant’s name. She asked leave to entertain the company with a dance, and Ali Baba, proud of her, agreed. She danced with a tambourine and a dagger, turning and turning — and at the dance’s last whirl she drove the dagger into the false merchant’s heart. Ali Baba started up in horror, until Morgiana drew back the man’s robe and showed the hidden blade, and the host understood that this servant had now saved his life three times over. In gratitude, Ali Baba gave Morgiana her freedom and married her to his son; and the family, the last on earth who knew the magic words, held the robbers’ treasure in peace for the rest of their days.

The Moral: Contentment Keeps What Greed Destroys

Set the two brothers side by side and the tale’s argument is plain. They stand before the same rock and speak the same words; the same mountain of gold lies open to each. Ali Baba takes a measured share and walks out a living man; Cassim cannot stop taking, and the taking kills him. Nothing in the cave changed between the two visits. Only the appetite carried into it changed — and that made all the difference between a fortune and a grave. Cassim is not punished for being rich; he was rich already. He is punished for the hunger that no amount of treasure could fill, the hunger that emptied his memory of the one word that would have set him free.

An Arabic proverb names the quality that saved the younger brother, the quality Cassim never owned:

القَنَاعَةُ كَنزٌ لا يَفنَى

“Al-qaná‘atu kanzun lá yafná” — Contentment is a treasure that never runs out.

Ali Baba is wealthy in that treasure long before he ever finds the cave: a poor woodcutter who carries no envy of his brother’s silk and fine house is a man already at peace. The gold of the robbers only makes visible what was true of him all along. And the tale sets beside this a second, quieter lesson, carried entirely by Morgiana. Three times the household is saved, and never once by its master’s strength or by the brothers’ gold — always by the steady wit of the person with the lowest rank and the fewest rights in the house. The story asks its listeners to count again, and to notice whom they had failed to count: the servant, the woman, the one without a sword. Worth, it insists, does not sit where the world expects to find it.

Why the Tale Has Lasted

For a story that was probably never part of the medieval Arabic Nights, Ali Baba has had an extraordinary reach. Its two magic words leapt the bounds of the tale entirely: “Open Sesame” is now a phrase understood across the world, used for everything from children’s games to computer passwords, and one of the largest commercial enterprises of the modern age took the woodcutter’s name for its own. From Galland’s French the tale passed into every European language, became a fixture of the British Christmas pantomime, and was retold in countless films, cartoons, and picture books — each version keeping the same unmistakable bones: the forest, the rock, the forty robbers, the oil-jars, and the dance.

Folklorists place it as tale type ATU 954, “The Forty Thieves,” a story of a hidden robber-hoard, a secret of access, and a clever defeat of the band that guards it. But its endurance owes as much to Morgiana as to the cave. Long before modern storytelling prized the quick-witted heroine, this tale handed its bravery, its planning, and its decisive final blow to an enslaved girl — and rewarded her with freedom. The rediscovery of Galland’s diary in 1881, and the slow recovery of Hanna Diyab’s name, gave the tale a last fitting irony: the most “Eastern” of treasure-stories turns out to have a real and once-forgotten author, a young traveller from Aleppo who arrived in a great foreign city with nothing to his name but a store of remembered tales — and who, like Ali Baba at the rock, found that the right words, well spoken, can open a door no one expected to open at all.

Ad Space (in-content)

Frequently Asked Questions

What is the moral of Ali Baba and the Forty Thieves?

The moral is that honesty, cleverness, and loyalty triumph over greed and violence. Curiosity and courage can bring great fortune, while greed and betrayal invite destruction — and a clever servant can save a household against overwhelming odds.

Who wrote Ali Baba and the Forty Thieves?

Ali Baba is part of the 'One Thousand and One Nights' (Arabian Nights) but it's one of the famous 'orphan tales' — it does not appear in original Arabic manuscripts. It was added by French translator Antoine Galland in 1712, reportedly from a Syrian Maronite storyteller named Hanna Diab whom he met in Paris.

What is the story of Ali Baba and the Forty Thieves?

Ali Baba, a poor woodcutter, spies on forty thieves entering a treasure cave that opens with the phrase 'Open Sesame!' He takes some gold and lives well. His greedy brother Cassim learns the secret, goes to the cave, but forgets the password and is killed. The thieves come for Ali Baba, but his clever servant Morgiana outsmarts them — pouring boiling oil on hiding thieves and stabbing the captain during a dinner dance.

What does 'Open Sesame' mean?

'Open Sesame' is the magical password that opens the thieves' treasure cave. 'Sesame' refers to the sesame plant, whose seed pods famously burst open when ripe — a natural image of sudden opening. The phrase entered English as an idiom for a seemingly magical way to access anything. It comes directly from this Arabian Nights tale.

Who is Morgiana in Ali Baba and the Forty Thieves?

Morgiana is Ali Baba's slave-girl (later freed and married to his son), and she is the true hero of the story. She discovers the thieves hidden in oil jars and kills them, then later recognizes their disguised captain and assassinates him mid-performance. In many scholarly readings, Ali Baba survives entirely because of Morgiana's brilliance and bravery.
Ad Space (after-content)

Get a New Story Every Week!

Join thousands of parents and teachers who receive our hand-picked folk tales every Friday. Stories with morals your kids will love.

Free forever. No spam. Unsubscribe anytime.