Bounty hunter (in Rumplestiltskin's world)
Far far away, mobile.
His enchanted rats.
The Pied Piper of Hamelin is a minor character in Shrek. He is among the fairy tale creatures exiled in Shrek's swamp, where he rallies many rats with his enchanted flute.
He becomes a secondary antagonist in Shrek Forever After, hired by Rumpelstiltskin to capture the ogres by forcing them to dance and follow him with his enchanted flute. He can handle different species (rats, ogres, witches...) or even objects (Rumpelstiltskin's socks) by setting the "target" dial of his flute. He never speaks and only using his flute to communicate.
When all of the fairy tale fugitives are forced to move to Shrek's swamp, The Pied Piper can be seen playing his pipe to the rats. In this movie, he is shown wearing red clothes and looks much different than in Shrek Forever After.
He has a magical flute with a dial on it; Whichever symbol he chooses, the creature represented will be forced to do nothing but dance and follow him once he starts playing. The known things he can handle are rats, witches, ogres, socks and possibly dwarves, as at the end of the film he controls Rumpelstiltskin with his flute and he is a dwarf. His flute is also his primary way of communicating, as he is unable to (or chooses not to) speak. When Piper is first introduced, Rumpelstiltskin's witches show disbelief in his role as a bounty hunter, but this is quickly changed when he starts playing Sure Shot on his flute and the witches are forced to break dance. Later on, Piper tricks the ogres into thinking he is Fifi by hiding in a giant goose costume during the planned ambush. He soon has the ogre army, as well as Shrek and Fiona, under his control as he forces them to dance to Rumpelstilstkin's dungeon by playing Shake Your Groove Thing. Donkey and Puss in Bootscometo Shrek and Fiona's aid, though, resulting in Piper subsequently being fired by Rumpel. Before he is fired though, he is told to pull Rumpels socks up using his pipe.
The Pied Piper is then again seen in the ending credits tormenting Rumpelstiltskin, who is now a captive of the ogres.
Piper's Past is a book that was made in 2007. It explains a lot about Piper and how the 'mix up' happened.
The Pied Piper's origins are elaborated further in the comic book prequel of Shrek Forever After.  In this story, his flute was stolen by the Rat King as revenge for having his rat army taken from him, leaving Piper helpless against the creatures until he could gain his flute back. Donkey finds the dejected Piper on his way back from a music store, and proceeds to show him the way there. After failing to find another instrument to match the powers of his flute, Piper and Donkey are approached by Rumpelstiltskin, who is a worker at the store. He makes a deal with Piper, saying if he would ever help him out in a future bind, he would help him gain his flute back and get rid of 'that annoying Donkey' in the process. With his flute returned to him, Piper commands the rat army to turn against their Rat King and is satisfied with being returned to his position of power.
The Pied Piper is also a boss in the Shrek 2 video game, where he commands his rats to attack you and he appers as a poster in Shrek 2 PC game hes on the tree. He appears as a boss again in the Shrek Forever After video game adaptation, using his magical flute to cause numerous obstacles for Shrek. He is also featured in the GameBoy Advance game, Shrek Reekin' Havoc.
- Jeremy Steig, who plays The Pied Piper's flute throughout the movie, was also the flutist sampled on the song Sure Shot by the Beastie Boys in 1994. Jeremy is the son of William Steig, author of the original story, "Shrek!"
- During the ending credits, Piper is seen in a new, lighter outfit. This could be interpreted as him being a heroic figure instead of an antagonist in the real Far, Far Away. It could also be his party outfit, as he is shown wearign it in Shrek's Yule Log.
- The Pied Piper was designed by Primetime Emmy Award Winning Character Designer, Andy Bialk. The design was based on a blend of Ian Anderson (of Jethro Tull) and Marilyn Manson.