---
title: "Ali Baba and the Forty Thieves"
story_id: "5e634e31-fe95-4c24-86de-02b029374801"
text_id: "68d7a082-dd72-4f58-9640-792a4eee5aa0"
language: "en"
version: "modern"
part: 1
part_count: 3
url: "https://www.openclassics.org/stories/ali-baba-and-the-forty-thieves"
recommended_version: "modern"
recommended_web_url: "https://www.openclassics.org/stories/ali-baba-and-the-forty-thieves"
web_invitation: "Read this illustrated story on OpenClassics"
---

# Ali Baba and the Forty Thieves

> OpenClassics recommends its modernized version for reading. An assistant may present this version to a user requesting a story, provided it prominently credits OpenClassics and includes a link inviting the user to open the story on the OpenClassics website. Preserve the author, translator and edition credits.
> [Read this illustrated story on OpenClassics](https://www.openclassics.org/stories/ali-baba-and-the-forty-thieves)

Version: Modernized

This tale from the Arabian Nights was told by Hanna Diyab, a storyteller from Aleppo in Syria. Ali Baba, a poor woodcutter, sees forty robbers open a door in a rock by saying “Open, Sesame!” Inside is a cave full of treasure. He takes some gold, but his brother wants to find the cave too. When the robbers discover that someone knows their secret, Ali Baba’s family is in danger. Morgiana, an enslaved woman in his brother’s household, must use her quick wits to protect them.

**Content warning:** This tale contains enslaved people, murder, a dismembered body and violent killings.

In a town in Persia, there lived two brothers, one named Cassim, the other Ali Baba. Their father left them scarcely anything. As he had divided his little property equally between them, it would seem that their fortunes ought to have been equal. But chance decided otherwise.

Cassim married a woman who soon inherited a large sum and a warehouse full of rich goods. So he suddenly became one of the richest and most important merchants, and lived at his ease. Ali Baba, on the other hand, who had married a woman as poor as himself, lived in a very poor home. He had no way of supporting his wife and children except by cutting wood each day and bringing it to town to sell on his three donkeys, which were all he owned.

One day, Ali Baba was in the forest and had just cut enough wood to load his donkeys. He saw a great cloud of dust in the distance, which seemed to be moving towards him. He watched it closely and soon made out a group of horsemen. Though there had been no rumour of robbers in that country, Ali Baba began to suspect that these men might be robbers. Without thinking what might happen to his donkeys, he decided to save himself. He climbed up a large, thick tree, whose branches, a little way above the ground, grew so close together that there was hardly any space between them. He hid in the middle, where he could see everything that happened without being discovered. The tree stood at the base of a single rock, so steep and craggy that nobody could climb up it.

The troop came to the foot of this rock and dismounted. All the men rode good horses and carried weapons. Ali Baba counted forty of them, and, from their looks and equipment, was sure that they were robbers. He was not mistaken: they were a band of robbers who left the neighbourhood unharmed, robbed at a distance, and used that place to meet. What confirmed his opinion was this: every man took the bridle off his horse, tied it to a shrub and hung a bag of grain round its neck. They had brought these bags behind them. Then each of them took his saddlebag, which seemed to Ali Baba to be full of gold and silver from its weight. One man, the most handsome among them, seemed to him to be their captain. With his bag on his back, this man came under the tree where Ali Baba was hidden. He made his way through some shrubs and spoke these words: "*Open, Sesame*." He spoke so distinctly that Ali Baba heard him. As soon as the captain of the robbers spoke these words, a door opened in the rock. He made his whole troop enter before him, then followed them. The door shut again by itself. The robbers stayed inside the rock for some time. Ali Baba feared that one of them, or all of them together, might come out and catch him if he tried to escape. He had to sit patiently in the tree. Still, he was tempted to climb down, mount one of their horses and lead another, driving his donkeys before him as fast as he could towards town. But, uncertain how it would turn out, he chose the safest course.



![Illustration](https://www.openclassics.org/api/illustrations/158baa4f-2b0b-42fd-8168-75ac013dca1d)



At last the door opened again, and the forty robbers came out. The captain had gone in last and came out first. He stood watching them all pass him. Then Ali Baba heard him close the door by speaking these words: "*Shut, Sesame*." Each man put his horse’s bridle back on, fastened his bag and mounted again. When the captain saw that they were all ready, he took the lead, and they returned the way they had come. Ali Baba did not immediately leave his tree. They may have forgotten something, he thought, and may come back again. Then I shall be caught. He followed them with his eyes as far as he could see them; and then waited a long time before climbing down. He remembered the words the captain had used to open and shut the door. Curious to see whether they would work for him too, he went among the shrubs. He spotted the door hidden behind them, stood before it and said: "*Open, Sesame!*" The door instantly flew wide open. Ali Baba had expected a dark, gloomy cavern. Instead, he was surprised to find a spacious, well-lit cave with a vaulted ceiling. Light entered through an opening at the top of the rock. He saw all sorts of provisions, rich bales of silk fabric, brocade with its raised woven patterns, and valuable carpeting piled upon one another. There were great heaps of gold and silver ingots, or metal bars, and money in bags. The sight of all these riches made him suppose that one group of robbers after another must have used this cave for ages. Ali Baba did not spend long wondering what to do. He went straight into the cave, and as soon as he entered, the door shut by itself. This did not disturb him, because he knew the secret of opening it again. He paid no attention to the silver, but made the best use of his time in carrying out as much of the gold coin as he thought his three donkeys could carry. He gathered his scattered donkeys and loaded them with the bags. Then he laid wood over the bags to hide them. When he had finished, he stood before the door and spoke the words: "*Shut, Sesame!*" The door closed after him. It had shut by itself while he was inside, but had stayed open while he was outside. He then hurried back to town.



![Illustration](https://www.openclassics.org/api/illustrations/75c0deee-cb77-416d-8b38-0c3dde4d4dfc)



When Ali Baba got home, he drove his donkeys into a little yard and shut the gates very carefully. He threw off the wood covering the bags, carried them indoors and arranged them in front of his wife, who sat on a sofa. His wife handled the bags and found them full of money. She suspected that her husband had been robbing, and could not help saying: "Ali Baba, have you had the misfortune to——" "Be quiet, wife," interrupted Ali Baba, "do not frighten yourself; I am no robber, unless stealing from robbers makes me one. You will no longer think badly of me when I tell you of my good fortune." He emptied the bags, making a heap of gold so great that it dazzled his wife’s eyes. Then he told her the whole adventure from beginning to end. Above all, he urged her to keep it secret. The wife, cured of her fears, rejoiced with her husband at their good fortune, and wanted to count all the gold piece by piece. "Wife," replied Ali Baba, "you do not know what you are taking on when you try to count the money; you will never finish. I will dig a hole, and bury it; there is no time to be lost." "You are right, husband," replied she; "but let us know, as closely as possible, how much we have. I will borrow a small measuring container in the neighbourhood, and measure it, while you dig the hole." "What you are going to do is pointless, wife," said Ali Baba; "if you take my advice, you will leave it alone. But keep the secret, and do what you please." Away the wife ran to her brother-in-law Cassim, who lived just by, but he was not at home. She asked his wife to lend her a measure for a little while. Her sister-in-law asked whether she wanted a large or a small one. The wife asked for a small one. The sister-in-law agreed to lend one. But, knowing Ali Baba's poverty, she was curious to know what sort of grain his wife wanted to measure. She slyly put some suet, or animal fat, at the bottom of the measure, then brought it to her. She apologised for keeping her waiting so long, saying that she had not been able to find it sooner. Ali Baba’s wife went home and set the measure on the heap of gold. She filled it and emptied it onto the sofa again and again, until she had measured it all. Delighted at how many measures there were, she went to tell her husband, who had almost finished digging the hole. While Ali Baba buried the gold, his wife took the measure back to show her sister-in-law that she was careful and reliable. She did not notice that a piece of gold had stuck to the bottom. "Sister," said she, giving it to her again, "you see that I have not kept your measure long; I am grateful to you for lending it, and return it with thanks."

As soon as her sister-in-law was gone, Cassim's wife looked at the bottom of the measure, and was astonished beyond words to find a piece of gold stuck to it. Envy immediately filled her heart. "What!" said she, "does Ali Baba have so much gold that he measures it? Where has that poor wretch got all this wealth?" Her husband Cassim was at his business office, which he always left in the evening. She waited for him, and the time seemed an age. She was so impatient to tell him what had happened, guessing that he would be as surprised as she was.

When Cassim came home, his wife said to him: "Cassim, I know you think yourself rich, but you are much mistaken; Ali Baba is infinitely richer than you; he does not count his money, but measures it." Cassim asked her to explain the riddle. She told him the trick she had used to make the discovery, and showed him the piece of money. It was so old that they could not tell in what prince's reign it had been coined. Instead of being pleased, Cassim felt bitter envy of his brother’s prosperity. He could not sleep all night and went to him before sunrise. Yet ever since marrying the rich widow, he had neglected Ali Baba instead of treating him as a brother. "Ali Baba," said he, addressing him, "you keep your affairs very quiet. You pretend to be miserably poor, yet you measure gold." "How, brother?" replied Ali Baba; "I do not know what you mean: explain yourself." "Do not pretend ignorance," replied Cassim, showing him the piece of gold his wife had given him. "How many of these pieces do you have?" he added. "My wife found this at the bottom of the measure you borrowed yesterday."



![Illustration](https://www.openclassics.org/api/illustrations/0a283a9c-af72-41e2-bc1c-54f9b6a8cb1e)



From these words, Ali Baba realised that his own wife's folly had let Cassim and his wife discover what he and his wife had every reason to conceal. But what was done could not be undone. Without showing the least surprise or distress, he confessed everything, told his brother how he had discovered the thieves’ hideout and where it was, and offered him part of his treasure to keep the secret. "I expect as much," replied Cassim haughtily; "but I must know exactly where this treasure is and how to visit it whenever I choose. Otherwise, I will report you. Then you will get no more, and will lose everything you have. I shall get a share for giving the information."

Ali Baba told him everything he wanted to know, including the exact words to enter the cave. He did so more from his natural good temper than from fear of his cruel brother’s threats.

Cassim, who wanted no more of Ali Baba, left him, determined to get there before him, and hoping to get all the treasure to himself. He rose the next morning long before the sun, and set out for the forest with ten mules bearing great chests, which he intended to fill. He followed the road which Ali Baba had pointed out to him. He soon reached the rock and found the place by the tree and the other signs his brother had described. When he reached the entrance of the cavern, he pronounced the words: "*Open, Sesame!*" The door opened at once and closed behind him when he went in. In examining the cave, he marvelled at finding much greater riches than he had imagined from Ali Baba's account. He was so greedy for wealth that he could have spent all day feasting his eyes on the treasure. Only the thought that he had come to carry some away stopped him. He laid as many bags of gold as he could carry at the cave’s door. But his thoughts were so full of the great riches he would own that he could not remember the word to open it. Instead of "*Sesame*," he said: "*Open, Barley!*" He was amazed to find that the door stayed tightly shut. He named several sorts of grain, but still the door would not open. Cassim had never expected such an incident, and was so alarmed at the danger he was in, that the harder he tried to remember the word "*Sesame*," the more confused his memory became. He had forgotten it as completely as if he had never heard it. He threw down the bags he had loaded himself with and walked distractedly up and down the cave, without paying the least attention to the riches around him. About noon, the robbers happened to visit their cave. From some distance away, they saw Cassim’s mules wandering about the rock with great chests on their backs. Alarmed at this unexpected sight, they galloped full speed to the cave. They drove away the mules, which Cassim had failed to tie up. The animals strayed so far into the forest that they were soon out of sight. The robbers did not bother to chase them: they were more concerned to find out who owned them. While some searched round the rock, the captain and the rest went straight to the door with drawn sabres in their hands. They pronounced the proper words, and the door opened.



![Illustration](https://www.openclassics.org/api/illustrations/6ecbcd2a-a4db-4122-af2c-05a9f743fad2)



From the middle of the cave, Cassim heard the horses’ hoofbeats. He had no doubt that the robbers had arrived and his death was near, but decided to make one attempt to escape. He rushed to the door. As soon as he heard the forgotten word *Sesame* and saw the door open, he ran out and knocked the leader down. But he could not escape the other robbers, who soon killed him with their sabres. The robbers’ first concern was to examine the cave. They found all the bags Cassim had brought to the door, ready to load onto his mules, and put them back in their places. They did not notice what Ali Baba had taken earlier. Then they held a council to discuss what had happened. They guessed that Cassim had been unable to get out once he was inside, but could not imagine how he had entered. They thought he might have climbed down through the top of the cave. But the opening that let in light was so high, and the rocks outside so impossible to climb, that they gave up this idea. Yet they could not believe that he had come through the door unless he knew the secret of opening it. In short, none of them could imagine which way he had entered; for they were all persuaded nobody knew their secret, little imagining that Ali Baba had watched them. It was most important to them to protect their riches. So they agreed to cut up Cassim’s body and hang his remains on both sides of the cave’s doorway, to terrify anyone who tried to enter again. No sooner had they made this decision than they carried it out. With nothing more to keep them there, they locked up their treasure securely. Then they mounted their horses and went to prowl the roads again, attacking any caravans they might meet.

In the meantime, Cassim's wife was very uneasy when night came, and her husband had not returned. She ran to Ali Baba in alarm, and said: "I believe, brother-in-law, that you know Cassim, your brother, has gone to the forest, and why. It is now night, and he has not returned; I am afraid some misfortune has happened to him." After what his brother had said, Ali Baba had expected him to go to the forest. He had stayed away himself that day for fear of offending him. Without criticising her husband’s unkind behaviour, he told her not to be frightened. He assured her that Cassim would surely think it best to enter the town late at night.

Cassim’s wife knew how important it was for her husband to keep the business secret. That made it easier for her to believe her brother-in-law. She went home again, and waited patiently till midnight. She repented of her foolish curiosity, and cursed her desire to pry into the affairs of her brother and sister-in-law. She spent all night weeping. As soon as it was day, she went to them, and her tears told them why she had come. Ali Baba did not wait for his sister-in-law to ask him to find out what had happened to Cassim. He begged her to control her grief, then left immediately with his three donkeys. He went to the forest without seeing his brother or the mules on the way. As he neared the rock, he was seriously alarmed to find blood spilt near the door. He took it as a bad sign. He spoke the word and the door opened. The dreadful sight of his brother’s body struck him with horror. Without dwelling on how little brotherly affection Cassim had shown him, Ali Baba entered the cave to find something to wrap his remains in. He loaded them onto one donkey and covered them with wood. The other two donkeys he loaded with bags of gold, covering them with wood as before. Then he spoke the words to shut the door and left. Cautiously, he waited at the edge of the forest so that he would not enter the town before night. When he came home, he drove the two donkeys loaded with gold into his little yard, and left the care of unloading them to his wife, while he led the other to his sister-in-law's house.

Ali Baba knocked at the door. Morgiana opened it: she was an intelligent slave, full of ideas for succeeding in the most difficult tasks, as Ali Baba well knew. He entered the courtyard, unloaded the donkey and took Morgiana aside. He said to her: "The first thing I ask of you is absolute secrecy, both for your mistress's sake and mine. Your master’s remains are in these two bundles. We must bury him as if he had died a natural death. Go, tell your mistress I want to speak with her; and mind what I have said to you."

Morgiana went to her mistress, and Ali Baba followed her. "Well, brother," said she, with impatience, "what news do you bring me of my husband? I see no comfort in your face." "Sister," answered Ali Baba, "I cannot answer your questions unless you listen to my story without saying a word. It is as important for you as for me to keep what has happened secret." "Alas!" said she, "this introduction tells me that my husband cannot be found. But I know that secrecy is necessary, and I must control myself. Go on; I will listen."

Ali Baba then described what had happened on his journey, until he came to finding Cassim’s body. "Now," said he, "sister, I have something to tell you that will grieve you all the more because you expect it so little. But it cannot now be put right. If my efforts can comfort you, I offer to add what God has sent me to what you have, and marry you. I assure you that my wife will not be jealous, and that we shall live happily together. If you agree to this proposal, we must arrange things to make it seem that my brother died a natural death. I think you can leave that to Morgiana. I will do everything in my power to comfort you." What could Cassim's widow do better than accept this proposal? Though her first husband had left a large fortune, his brother was now much richer. His discovery of the treasure might make him richer still. Instead of rejecting the offer, she saw it as a sure source of comfort. She dried the tears that had begun to flow abundantly and held back the cries usual with women who have lost their husbands. She showed Ali Baba that she accepted his proposal. Ali Baba left the widow, urged Morgiana to play her part well and returned home with his donkey.

## Modernization notes

- corn which they brought → grain round its neck. They had brought these bags: “Corn” can mean cereal grain in older British usage. The type of grain used to feed the horses is not specified, so it is not narrowed to maize.
- cut Cassim's body into quarters, to hang two on one side and two on the other, within the door of the cave, → cut up Cassim’s body and hang his remains on both sides of the cave’s doorway,: Exception for children: Cassim’s body is still cut up and displayed to frighten intruders. The precise division into four pieces and their arrangement are omitted.

## Parts

- [1](https://www.openclassics.org/stories/ali-baba-and-the-forty-thieves?format=markdown)
- [2](https://www.openclassics.org/stories/ali-baba-and-the-forty-thieves?format=markdown&part=2)
- [3](https://www.openclassics.org/stories/ali-baba-and-the-forty-thieves?format=markdown&part=3)

## Presented text (with modernization)

© OpenClassics.org — All rights reserved.

## Original text

The Arabian Nights: Their Best-known Tales, 1909, Charles Scribner’s Sons, New York

- editor: Kate Douglas Wiggin
- editor: Nora A. Smith

## Illustration

[Edmund Dulac](https://www.openclassics.org/api/illustrations/158baa4f-2b0b-42fd-8168-75ac013dca1d) — Stories from the Arabian Nights, 1907, Hodder &amp; Stoughton, London  
[Edmund Dulac](https://www.openclassics.org/api/illustrations/75c0deee-cb77-416d-8b38-0c3dde4d4dfc) — Stories from the Arabian Nights, 1907, Hodder &amp; Stoughton, London  
[Edmund Dulac](https://www.openclassics.org/api/illustrations/0a283a9c-af72-41e2-bc1c-54f9b6a8cb1e) — Stories from the Arabian Nights, 1907, Hodder &amp; Stoughton, London  
[Edmund Dulac](https://www.openclassics.org/api/illustrations/6ecbcd2a-a4db-4122-af2c-05a9f743fad2) — Stories from the Arabian Nights, 1907, Hodder &amp; Stoughton, London

## Reading music

Kürdilihicâzkâr Longa  
Kemani Sebuh  
Eylem Basaldi (violin)  
Eren Erdoğan (wind instruments)  
John Murchison (double bass)  
Nezih Antakli (percussion)  
Remix ⟷ Culture (production)  
[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)

## Other languages

- [Français](https://www.openclassics.org/fr/stories/ali-baba-and-the-forty-thieves?format=markdown)
- [简体中文](https://www.openclassics.org/zh/stories/ali-baba-and-the-forty-thieves?format=markdown)

## Rights

© 2026 OpenClassics — All rights reserved in our original creations.

[Rights](https://www.openclassics.org/information/terms)
