Rumpelstiltskin

Rumpelstiltskin (Rumpelstilzchen) is a German fairy tale collected by The Brothers Grimm, although the story exists in other countries under different names. (Many variants listed here.)

The story begins when a miller boasts to the king of his daughter's (exaggerated) domestic skills; in an effort to appear important, the miller tells him that she can even spin straw into gold. The king takes a bit more interest than intended, and the daughter soon finds herself in a room full of straw with nothing but a spinning wheel and a death threat from the king, to make good on her father's empty boast.

The task is impossible; she despairs; and a little man suddenly appears and offers to spin the straw to gold for her, in exchange for her necklace. The next night, under the same conditions, he again appears and does the work in exchange for her ring. The third night, the king tells her he will marry her if she completes the work, but she has nothing left to give the little man. At his suggestion, she promises him her first-born child, and he does the work on spec, as it were.

She and the king get married and have a child, and sure enough, the little man shows up and tries to take it away. However, seeing her grief, he relents and gives her a loophole: If she can guess his name in the next three days, she can keep the child.

So, for the next couple of days, the young queen lists every name she can think of, and sends out messengers to collect new ones, but the little man always denies that any of them is his name. By the third day, things are looking grim, until her messenger tells her that he overheard a little man singing a peculiar song: ""Tomorrow I brew, today I bake,

And then the child away I'll take;

For little deems my royal dame

That Rumpelstiltskin is my name!""

And so, at the last minute, the queen guesses the man is called Rumpelstiltskin, and he is so enraged that he stamps his foot right into the floor, and tears himself in two.

Rumpelstiltskin's reaction to his name varies depending on the version of the story; in the tale the Grimms first collected, he flew out of the window on a spoon. In the Grimms' early editions, he simply left in a huff. Later, they gave him the interesting but anatomically improbable death above (complete with illustration!).

A common joke in parodies is to have the story told through the eyes of a Private Detective who is hired by the Queen to investigate the name question.

Rumpelstiltskin contains examples of the following tropes:

 * Body Horror: In one version, Rumplestiltskin stamps one leg into the floor to his hip, then grabs his other leg and tears himself in two.
 * Deal With the Devil: It is implied that Rumpelstiltskin is, if not actually demonic, at least fey and up to no good.
 * In one British version of the tale, Duffy and the Devil, he is the devil. his name is given as "Tillytop", he laughs in Duffy's face when she guesses "Lucifer" and comments that Beelzebub is a distant cousin.
 * Exact Eavesdropping: Good thing that Rumpelstiltskin just happened to be singing about what his name was when the messenger overheard him.
 * The Fair Folk: The title character
 * I Know Your True Name: Once his name is revealed, Rumpelstiltskin is no longer a threat.
 * Impossible Task
 * Karma Houdini: The miller is never punished for his stupid boast.
 * Nor is the king, who's a greedy, cruel, and petty tyrant.
 * Karmic Death: Rumpelstiltskin's rage brings about his own death.
 * Leonine Contract
 * Mysterious Protector: A sinister variant.
 * Rule of Three: Rumpelstiltskin helps the girl three times; she has three nights to guess his name.
 * In some versions, she can guess three names per day, too.
 * Shout Out: Paper Mario the Thousand Year Door pays something of an homage to this story via Doopliss. Doopliss transforms into a shadowy version of Mario during a boss fight, but then pulls a switcheroo after the fight. He claims that he will undo everything if you guess his name correctly. You initially can't, and, quite conveniently, a lowercase P is missing from the name entry form. You learn Doopliss's name from a parrot trapped in the Creepy Steeple with the missing P in a treasure chest. After you guess his name, he defaults on his contract and runs back to the Creepy Steeple, where you must fight him again (and this time, he has your partners as his allies).
 * Strangely enough, later on in the game, he has no compunctions about hiding his name, and gives it away quite freely. A crow in Twilight Town mentions that when no one knew his name, he could use unstoppable magic; this becomes a key plot point when you battle him a second time near the end of the game. His powers are considerably toned down, although he gains the ability to turn into your partners.
 * His name is Rumpel/Rampel in the other languages.
 * Rumpelstiltskin is the villain in the fourth Shrek movie, where he grants Shrek a wish that ruins life for everybody (and makes Rumpelstiltskin the King, which is what he wanted.)