King Shahriman has four wives but no children. After many years of prayer, he finally has a son named Kamar al-Zaman. At 15, Kamar refuses to marry and insults his father in public. As a result, he is thrown in prison.
An Ifritah named Maymunah, daughter of the king of the jinn, sees Kamar and kisses him. The Ifrit Dahnash arrives and tells her about Princess Budur, the daughter of King Ghayur in China, who also doesn't want to marry. The two Ifrits argue over which is more beautiful, and finally put them together to compare them. A third, Kashkash, judges them equal in beauty, but tests them by waking each up while the other sleeps. They each fall in love with the other, and Kamar is declared the winner.
Kamar reawakens alone, asking for Budur. He is inconsolable and is eventually moved to a different palace. In China, Budur asks where Kamar is and kills her duenna when she says Kamar was never there. Budur is declared mad and chained up for three years. Many people try to cure her, but they all fail and are beheaded.
Budur's foster-brother Marzawan hears the story and goes searching for her prince. He finds Kamar and they run away in secret, with Marzawan faking Kamar's death. In China, Kamar disguises himself as an astrologer and shows Budur her ring. She is declared cure and the two marry.
The happy couple plans to visit Kamar's father, but en route, Kamar takes a jewel from Budur's clothing while she sleeps. A bird steals it, he follows the bird and gets lost, eventually winding up in a city where all the inhabitants are magicians and becoming a gardener's assistant.
Budur disguises herself as a man, using Kamar's name, and comes to the City of Ebony, where the elderly King Armanus tries to get her to marry his daughter Hayat al-Nufus. Budur confesses her true gender to Hayat, who pities her and helps her maintain the masquerade.
Kamar finds the lost jewel, as well as buried treasure. He manages to miss the ship, but his luggage containing his talisman arrives at the Ebony Islands, where Budur buys and recognizes it. Kamar arrives later and she gives him many gifts before revealing her identity. The next morning she confesses all to King Armanus. Hayat becomes Kamar's second wife and they all live happily for the rest of their lives.
- The element of the two djinn bringing the beautiful couple together is similar to the Tale of Núr al-Dín Alí and his Son.
- The characters' names have also been Anglicized as Camaralzaman and Badoura.