The audience is welcomed to the show by Feste, a jester, who introduces them to the world of Illyria and the many outlandish characters who inhabit the island: the overly mournful Countess Olivia, her officious steward Malvolio, her drunken uncle Sir Toby and his mischievous cohorts Sir Andrew (a hapless suitor of Olivia's) and the clever maidservant Maria. We also meet the passionate and self-indulgent Duke Orsino, ruler of the land. In the midst of these comic introductions, a violent storm shipwrecks the twins Viola and Sebastian off the coast of Illyria. Viola makes it to shore, but cannot find her brother. Distraught, she decides to assume his identity for her safety in an unknown territory.
Dressed as a boy and calling herself Sebastian, Viola enters into service of the Duke Orsino, who is unrequitedly smitten with the Countess Olivia. The two immediately hit it off, and the Duke sends his new manservant "Sebastian" to plead his suit to Olivia, even as Viola finds herself beginning to fall for her new master the Duke. Meanwhile, at Olivia's house, Feste returns after several years spent abroad. He is shocked to find Olivia still in mourning for her brother, his late master, and sets about bringing mirth into the household once again. He teases Maria about her longstanding flirtation with the debauched Sir Toby, and re-ignites a rivalry with Malvolio. Although Countess Olivia has been refusing all visitors, after Feste's intervention she decides to receive Viola, and is very taken with the pretty youth. As Viola returns to the Duke to report on this encounter, Malvolio catches up with her and gives her a ring, a gift from Olivia. Viola contemplates the implications of this gift, even as the real Sebastian, who has also survived the shipwreck, returns to Illyria with his rescuer, Antonio.
Later that night at Olivia's house, Feste, Toby, Sir Andrew, and Maria are all at odds with Olivia's stuffy steward, Malvolio, who squelches their midnight revels. The four plot a delicious revenge to humiliate the priggish steward. At the same time, across the island at the Duke's palace, romantic sparks fly between Viola and Orsino as they drink wine and share thoughts on love. Alone again, Viola vows patience, despite the impossible situation created by her disguise as a boy. However, tempers flare the following morning as the Duke learns that Viola has kept the gift of Olivia's ring a secret, and he once again dispatches Viola to Olivia to press his suit.
Meanwhile, Maria sets her revenge plot in motion by penning a "secret admirer" letter to Malvolio, cleverly written to seem as if it came from her mistress the Countess, and leaves it for him to find. The letter instructs Malvolio to show that he returns her affections by dressing and acting outrageously. Viola, in her second audience with the Countess Olivia, definitively discovers that the lady is now in love with her rather than her master, and has come undone. As the first act draws to a close, Viola, Olivia, and Orsino lament their seemingly hopeless situations.
As Act 2 begins, we see that Maria's letter has had the desired effect: Malvolio makes lascivious advances towards Olivia, while dressed garishly in cross-gartered yellow stockings. Olivia believes him mad, and has him taken away by Sir Toby.
With the real Sebastian's arrival on the scene, the comic plot becomes increasingly outrageous. He presents himself at the Duke's palace, and Orsino mistakenly declares his feelings of love to the real Sebastian, rather than Viola. Taken aback, Sebastian flees the Duke's palace for Olivia's house, and is once again mistaken for the "Sebastian" being impersonated by his sister (who he believes is dead). Both twins become entangled in a ridiculous duel with the cowardly Sir Andrew, which has been set-up through a scheme of Maria's and Toby's. Olivia rescues the real Sebastian from the duel, and romance ensues. Though confused, Sebastian willingly accepts the Countess Olivia's love.
Meanwhile, Malvolio has been imprisoned as a lunatic after behaving outrageously before Olivia, and pleads with Feste to release him – or at least carry a message to the Countess. Eventually, through an extended, madcap musical sequence, the twins are re-united and the misunderstandings are resolved. The Duke is matched with Viola, Olivia with Sebastian, Toby with his partner in crime Maria. Even the much-wronged Malvolio is somewhat consoled, and Feste and the full cast bid the audience farewell.