Henry IV is a man who went mad after being knocked off his horse during a masquerade. At the time he was playing the part of Henry IV, and his delusion for over twelve years after the fall was that he was King Henry IV of Germany during the eleventh century. He has been placed in a "castle" with four valets, or "private counselors", all paid for by his nephew Di Nolli.
The play opens in the throne room with Berthold, a new valet who has just been hired, learning from the other three valets. Berthold is being taught everything he needs to know in order to work for Henry IV and take care of the madman. There are two portraits next to the throne, pictures of Henry IV and the Marchioness Matilda (known as Donna Matilda). The pictures were done during the masquerade nearly twenty years earlier while Henry IV and Donna Matilda were dressed in their costumes.
Donna Matilda, her daughter Frida, Frida's fiance Di Nolli (who is also Henry IV's nephew), Donna Matilda's lover Belcredi, and a Doctor for psychotherapy all arrive at the castle. They are there in the hopes of curing Henry IV of his madness. Soon after their arrival the valets convince Donna Matilda, the Doctor, and Belcredi that it would be a good idea to visit Henry IV. They dress up in costumes and meet him. Henry speaks to them, but as far as they are concerned he is mad and so they do not pay attention to anything he says.
After the meeting with Henry IV, Donna Matilda is convinced that he recognized her. Both Belcredi and the Doctor try to dissuade her from this notion. Frida and Di Nolli have left to pick up the dress that Donna Matilda is seen wearing in the portrait, and they arrive soon thereafter. Frida enters wearing the dress; she looks identical to her mother's portrait.
Donna Matilda and the Doctor re-enter Henry's room in order to placate him and make him act calmer. After they leave, Henry turns to his valets and tells them that he is tired of acting. They look at him in surprise, and are even more shocked when he reveals that he is perfectly lucid. Henry has been playing the part of the madman for over eight years, having woken out of his madness after twelve years. He and the valets sit around a table and Henry tells them about what it means to be mad, claiming that madmen always speak the truth.
Meanwhile, the Doctor has set up a trap in order to shock Henry IV out of his madness. The portraits have been replaced by Frida and Di Nolli, dressed up to look like the Marchioness and Henry IV. Henry leaves his valets and starts to walk towards his bedroom, passing through the throne room on the way. Frida calls out to him, but she soon becomes frightened and starts to scream. The Doctor, Belcredi, and Donna Matilda all rush in to support her.
Henry watches this scene in amazement. Finally Belcredi and Donna Matilda tell Frida that Henry is cured, and that he has only been acting. It turns out that the valets came to them and confided everything that Henry had secretly told them. Henry explains that after waking up twelve years after the accident, he realized that he was more comfortable playing Henry IV than dealing with changes in the outer world. He therefore pretended to be Henry IV for over eight years.
Henry then discusses the variable nature of reality with them. He explains that since he is aware what mask he is wearing, that of Henry IV, and since he is also aware that other people also wear masks, he is not mad. He explains that madness is when someone wears a mask but is not aware of it. Belcredi comments that according to Henry IV, they are all mad.
After discussing the differences between his reality in which time has stopped and their reality in which it has not, Henry IV goes over to Frida and grabs hold of her. He starts laughing like a madman while hugging her. When the others try to free her, he orders his valets to restrain them. Only Belcredi is able to break free. Belcredi lunges forward, but Henry pulls out his sword and stabs him. In shock, the others carry Belcredi offstage where a loud cry from Donna Matilda indicates that he has died. Henry gather his valets around him and comments that they will now have to stay in the castle forever.