The story begins when the Spanish Ambassador moves in next door. His son, Pepito, is not a good boy. Madeline dubs him a 'bad hat'. The book is controversial due to the cruel nature of Pepito's mischief. After he suffers from his own actions, Pepito reforms himself.
Differences between the book and the special
- In the book, Madeline doesn't carry a red balloon in the beginning. In the special, when Madeline says Hi to Pepito he pops the balloon using a slingshot.
- In the book, while the girls are doing their morning exercise one spring day, Pepito hits a rock on Madeline's butt. In the special, he hits a rock on Chloe's butt causing her to moan in pain.
- In the book, when Pepito gets bandaged after he does one of his naughty pranks only a doctor and nurse are seen rushing into his room. In the special, Doctor Cohn takes care of Pepito treating his injuries.
- In the book, when Pepito turns into a vegetarian, he goes shopping for vegetables. In the special, he gets vegetables for dinner and gives a bunny a carrot.
- In the book, when the girls go to the zoo, there are lions when Madeline tells Pepito that he's no longer a bad hat. In the special, Madeline says "Pooh Pooh" to the tiger in the zoo.
- In the end of the book, while the girls are brushing their teeth they wave goodnight to Pepito. In the special, Pepito brushes his teeth and smiles a frog is seen on his head and croaks happily.