Orsino, the Duke of lllyria, is in love with the Countess Olivia. She has not dated any men for seven years because of the death of her brother, so she turns him down. Meanwhile, Viola was shipwrecked in Illyria but she has been rescued by a captain. She has lost her twin brother, Sebastian. She dresses herself as a boy and uses the name Cesario, so she can get work as a page for Orsino. As Orsino's page, Viola is sent to Olivia with love letters. Viola finds out, to her dismay, that Olivia has fallen for her (as a boy) rather than Duke Orsino. Also, Viola has already fallen in love with the Duke.
Sebastian (Viola's twin, thought to be dead) comes ashore in Illyria. He thinks Viola has drowned in the shipwreck. A man named Antonio has rescued him from the surf; at some risk to himself, because Antonio fought against the Duke at one time. Meanwhile, in Olivia's house, Sir Toby Belch (her cousin) has tricked Sir Andrew Aguecheek into supporting him, by convincing him that he could be a suitor for Olivia. So with the help of Maria, Olivia's maid, and Feste, a clown, Belch plots to make a fool of the steward. Maria writes a love letter to Malvolio that will make him think Olivia has fallen for him. Malvolio falls for the joke and dresses crazily as the letter says to. Not knowing it is a joke, the Countess is horrified and has Malvolio locked away as a madman.
Belch tries to get Sir Andrew to fight a duel with Viola's "Cesario" character as she leaves but Olivia has a crush on Cesario. Viola and Sir Andrew prepare for a duel that neither one wants. Antonio intervenes to defend Cesario, because he thinks he is his friend Sebastian, and is arrested for piracy against Orsino. Olivia has become engaged to Sebastian. Viola still does not recognize Antonio. Later, Belch and Sir Andrew talk to Sebastian, who does not back down from Aguecheek when challenged and beats him in the duel. Meanwhile, Olivia has met and become engaged to Sebastian.
Antonio is brought before the Duke for questioning, and Viola tells all about the duel. Antonio tells everyone how he dragged "this man" from the surf, saving his life. Then Olivia comes in, searching for her new husband, which she thinks is Viola. Adding to this confusion, Belch and Aguecheek enter claiming that Viola/Cesario has violently assaulted them. In the midst of Viola's denials, Sebastian shows up. The brother and sister recognize one another and are reunited. Sebastian helps to explain the confusion over who fought and married who.
In the end, Orsino and Viola are in love. Olivia and Sebastian are happily wed, and Olivia fusses at Belch and Maria for their abuse of Malvolio, who vows to get even. Belch agrees to wed Maria to make up for getting her in trouble. Everyone, except unhappy Malvolio, lives happily ever after. Orsino welcomes Olivia and Sebastian and he now realises he is attracted to Cesario. He promises to marry her as soon as she is dressed as a woman again.