A young boy listens to his Great-aunt's stories about a magical golden key found at the end of a rainbow. One day, he sees an immense rainbow and sets out to find its end in an enchanted forest. As the forest is in Fairyland where everything has an opposite effect, the rainbow only glows brighter when the sun sets. He finds the key, then it dawns on him that he does not know where the lock is.
In the same village on the border of this forest, a merchant's neglected daughter is frightened by the fairies. Their first attempt fails but when they make her think the three bears are coming into her bedroom, she flees into the woods.
A tree tries to trap her, but a feathered airborne fish frees her, then leads her to a wise woman's cottage. A pot is boiling there, and the air fish flies into it. The lady asks her name; the girl says that the servants always called her Tangle, and the lady decides that although her tangled hair was their fault for not looking after her, Tangle is a pretty name. She says she is called Grandmother, and that it has been three years since Tangle ran away from the "bears". She has the girl washed by fish and dresses her. Then they eat the air fish for dinner after the lady assures her that the air fish had voluntarily gone into the pot to be their food, and the cooking pot produces a little-winged figure, who flies off.
The lady sends another air fish after the young man at the foot of the rainbow. At supper the next day, the young man, Mossy, arrives. The lady tells Mossy that if he searches for the keyhole, he will find it, and sends Tangle with him. In their wanderings, they come across a valley where beautiful shadows fill the air, where they stay, grow old, and then resolve to find the land the marvelous shadows fall from; but they become separated so they each continue their journey alone.