Illyria, the setting of Twelfth Night, is important to the play's romantic atmosphere. Illyria was an ancient region of the Western Balkans whose coast (the eastern coast of the Adriatic Sea which is the only part of ancient Illyria which is relevant to the play) covered (from north to south) the coasts of modern-day Slovenia, Croatia, Bosnia and Herzegovina, Montenegro and Albania. It included the city state of the Republic of Ragusa which has been proposed as the setting. Illyria may have been suggested by the Roman comedy Menaechmi, the plot of which also involves twins who are mistaken for each other. Illyria is also referred to as a site of pirates in Shakespeare's earlier play, Henry VI, Part 2. The names of most of the characters are Italian but some of the comic characters have English names. Oddly the "Illyrian" lady Olivia has an English uncle, Sir Toby Belch. It has been noted that the play's setting also has other English allusions such as Viola's use of "Westward ho!", a typical cry of 16th-century London boatmen, and also Antonio's recommendation to Sebastian of "The Elephant" as where it is best to lodge in Illyria; The Elephant was a pub not far from the Globe Theatre.
Viola is shipwrecked on the coast of Illyria and she comes ashore with the help of a captain. She loses contact with her twin brother, Sebastian, whom she believes to be drowned. Disguising herself as a young man under the name Cesario, she enters the service of Duke Orsino through the help of the sea captain who rescues her. Duke Orsino has convinced himself that he is in love with Olivia, whose father and brother have recently died, and who refuses to see charming things, be in the company of men, and entertain love or marriage proposals from anyone, the Duke included, until seven years have passed. Duke Orsino then uses 'Cesario' as an intermediary to profess his passionate love before Olivia. Olivia, however, forgetting about the seven years in his case, falls in love with 'Cesario', as she does not realize the Duke's messenger is a woman in disguise. In the meantime, Viola has fallen in love with the Duke Orsino, creating a love triangle between Duke Orsino, Olivia and Viola: Viola loves Duke Orsino, Duke Orsino loves Olivia, and Olivia loves Viola disguised as Cesario.
In the comic subplot, several characters conspire to make Olivia's pompous steward, Malvolio, believe that Olivia has fallen for him. This involves Olivia's uncle, Sir Toby Belch; another would-be suitor, a silly squire named Sir Andrew Aguecheek; her servants Maria and Fabian; and her fool, Feste. Sir Toby and Sir Andrew engage themselves in drinking and revelry, thus disturbing the peace of Olivia's house until late into the night, prompting Malvolio to chastise them. Sir Toby famously retorts, "Dost thou think, because thou art virtuous, there shall be no more cakes and ale?" (Act II, Scene III) Sir Toby, Sir Andrew, and Maria are urged to plan revenge on Malvolio. They convince Malvolio that Olivia is secretly in love with him by planting a love letter, written by Maria in Olivia's handwriting. It asks Malvolio to wear yellow stockings cross-gartered, to be rude to the rest of the servants, and to smile constantly in the presence of Olivia. Malvolio finds the letter and reacts in surprised delight. He starts acting out the contents of the letter to show Olivia his positive response. Olivia is shocked by the changes in Malvolio and leaves him to the contrivances of his tormentors. Pretending that Malvolio is insane, they lock him up in a dark chamber. Feste visits him to mock his insanity, both disguised as a priest and as himself.
Meanwhile, Sebastian (who had been rescued by his friend Antonio, a brigand who Orsino wants arrested) arrives on the scene, which adds confusion of mistaken identity. Mistaking Sebastian for 'Cesario', Olivia asks him to marry her, and they are secretly married in a church. Finally, when 'Cesario' and Sebastian appear in the presence of both Olivia and Orsino, there is more wonder and confusion at their similarity. At this point, Viola reveals her disguise and that Sebastian is her twin brother. The play ends in a declaration of marriage between Duke Orsino and Viola, and it is learned that Sir Toby has married Maria. Malvolio swears revenge on his tormentors and stalks off, but Orsino sends Fabian to placate him.
The full title of the play is Twelfth Night, or What You Will. Subtitles for plays were fashionable in the Elizabethan era, and though some editors place The Merchant of Venice's alternative title, The Jew of Venice, as a subtitle, this is the only Shakespearean play to bear one when first published.
The play was probably finished between 1600 and 1601, a period suggested by the play's referencing of events which happened during that time. A law student, John Manningham, who was studying in the Middle Temple in London, described the performance on 2 February 1602 (Candlemas) which took place in the hall of the Middle Temple at the formal end of Christmastide in the year's calendar, and to which students were invited. This was the first recorded performance of the play. The play was not published until its inclusion in the First Folio in 1623.
Viola is not alone among Shakespeare's cross-dressing heroines; in Shakespeare's theatre, convention dictated that adolescent boys play the roles of female characters, creating humour in the multiplicity of disguise found in a female character who for a while pretended at masculinity. Her cross dressing enables Viola to fulfill usually male roles, such as acting as a messenger between Orsino and Olivia, as well as being Orsino's confidant. She does not, however, use her disguise to enable her to intervene directly in the plot (unlike other Shakespearean heroines such as Rosalind in As You Like It and Portia in The Merchant of Venice), remaining someone who allows "Time" to untangle the plot. Viola's persistence in transvestism through her betrothal in the final scene of the play often engenders a discussion of the possibly homoerotic relationship between Viola and Orsino.
As the very nature of Twelfth Night explores gender identity and sexual attraction, having a male actor play Viola enhanced the impression of androgyny and sexual ambiguity. Some modern scholars believe that Twelfth Night, with the added confusion of male actors and Viola's deception, addresses gender issues "with particular immediacy." They also accept that the depiction of gender in Twelfth Night stems from the era's prevalent scientific theory that females are simply imperfect males. This belief explains the almost indistinguishable differences between the sexes reflected in the casting and characters of Twelfth Night.
At Olivia's first meeting with "Cesario" (Viola) in I.V she asks her "Are you a comedian?" (an Elizabethan term for "actor"). Viola's reply, "I am not that I play", epitomising her adoption of the role of Cesario, is regarded as one of several references to theatricality and "playing" within the play. The plot against Malvolio revolves around these ideas, and Fabian remarks in Act III, Scene iv: "If this were play'd upon a stage now, I could condemn it as an improbable fiction". In Act IV, Scene ii, Feste (The Fool) plays both parts in the "play" for Malvolio's benefit, alternating between adopting the voice of the local curate, Sir Topas, and his own voice. He finishes by likening himself to "the old Vice" of English Morality plays. Other influences of the English folk tradition can be seen in Feste's songs and dialogue, such as his final song in Act V. The last line of this song, "And we'll strive to please you every day", is a direct echo of similar lines from several English folk plays.
The earliest known performance took place at Middle Temple Hall, one of the Inns of Court, on Candlemas night, 2 February 1602. The only record of the performance is an entry in the diary of the lawyer John Manningham, who wrote:
At our feast we had a play called "Twelve Night, or What You Will", much like "The Comedy of Errors" or "Menaechmi" in Plautus, but most like and near to that in Italian called "Inganni". A good practice in it to make the steward believe his lady-widow was in love with him, by counterfeiting a letter as from his lady, in general terms telling him what she liked best in him and prescribing his gesture in smiling, his apparel, etc. and then, when he came to practice, making him believe they took him for mad.
Clearly, Manningham enjoyed the Malvolio story most of all, and noted the play's similarity with Shakespeare's earlier play, as well as its relationship with one of its sources, the Inganni plays.
It may have been performed earlier as well, before the Court at Whitehall Palace on Twelfth Night (6 January) of 1601. Twelfth Night was also performed at Court on Easter Monday, 6 April 1618, and again at Candlemas in 1623.
The play was also one of the earliest Shakespearean works acted at the start of the Restoration; Sir William Davenant's adaptation was staged in 1661, with Thomas Betterton in the role of Sir Toby Belch. Samuel Pepys thought it "a silly play", but saw it three times anyway during the period of his diary on 11 September 1661, 6 January 1663, and 20 January 1669. Another adaptation, Love Betray'd, or, The Agreeable Disappointment, was acted at Lincoln's Inn Fields in 1703.
After holding the stage only in the adaptations in the late 17th century and early 18th century, the original Shakespearean text of Twelfth Night was revived in 1741, in a production at Drury Lane. In 1820 an operatic version by Frederic Reynolds was staged, with music composed by Henry Bishop.
Influential productions were staged in 1912, by Harley Granville-Barker, and in 1916, at the Old Vic.
Lilian Baylis reopened the long-dormant Sadler's Wells Theatre in 1931 with a notable production of the play starring Ralph Richardson as Sir Toby and John Gielgud as Malvolio. The Old Vic Theatre was reopened in 1950 (after suffering severe damage in the London Blitz in 1941) with a memorable production starring Peggy Ashcroft as Viola. Gielgud directed a production at the Shakespeare Memorial Theatre with Laurence Olivier as Malvolio and Vivien Leigh playing both Viola and Sebastian in 1955. The longest running Broadway production by far was Margaret Webster's 1940 staging starring Maurice Evans as Malvolio and Helen Hayes as Viola. It ran for 129 performances, more than twice as long as any other Broadway production.
A memorable production directed by Liviu Ciulei at the Guthrie Theater in Minneapolis, October–November 1984, was set in the context of an archetypal circus world, emphasising its convivial, carnival tone.
When the play was first performed, all female parts were played by men or boys, but it has been the practice for some centuries now to cast women or girls in the female parts in all plays. The company of Shakespeare's Globe, London, has produced many notable, highly popular all-male performances, and a highlight of their 2002 season was Twelfth Night, with the Globe's artistic director Mark Rylance playing the part of Olivia. This season was preceded, in February, by a performance of the play by the same company at Middle Temple Hall, to celebrate the 400th anniversary of the play's première, at the same venue. The same production was revived in 2012-13 and transferred to sell-out runs in the West End and Broadway. Stephen Fry played Malvolio. It ran in repertory with Richard III.
Interpretations of the role of Viola have been given by many well-renowned actresses in the latter half of the 20th century, and have been interpreted in the light of how far they allow the audience to experience the transgressions of stereotypical gender roles. This has sometimes correlated with how far productions of the play go towards reaffirming a sense of unification, for example a 1947 production concentrated on showing a post-World War II community reuniting at the end of the play, led by a robust hero/heroine in Viola, played by Beatrix Lehmann, then 44 years old. The 1966 Royal Shakespeare Company production played on gender transgressions more obviously, with Diana Rigg as Viola showing much more physical attraction towards the duke than previously seen, and the court in general being a more physically demonstrative place, particularly between males. John Barton's 1969 production starred Donald Sinden as Malvolio and Judi Dench as Viola; their performances were highly acclaimed and the production as a whole was commented on as showing a dying society crumbling into decay.
Malvolio is a popular character choice among stage actors; others who have taken the part include Ian Holm many times, Simon Russell Beale (Donmar Warehouse, 2002), Richard Cordery in 2005, Patrick Stewart, in Chichester, in 2007, Derek Jacobi (Donmar Warehouse) in 2009, Richard Wilson in 2009 and Stephen Fry at the Globe in 2012. In late 2017, the Royal Shakespeare Company will stage Twelfth Night, which will be directed by Christopher Luscombe.
Due to its themes such as young women seeking independence in a "man's world", "gender-bending" and "same-sex attraction" (albeit in a roundabout way), there have been a number of re-workings for the stage, particularly in musical theatre, among them Your Own Thing (1968), Music Is (1977), All Shook Up (2005), and Play On! (1997), the last two jukebox musicals featuring the music of Elvis Presley and Duke Ellington, respectively. Another adaptation is Illyria, by composer Pete Mills. Theatre Grottesco created a modern version of the play from the point of view of the servants working for Duke Orsino and Lady Olivia. The adaptation takes a much deeper look at the issues of classism, and society without leadership. In 1999, the play was adapted as Epiphany by the Takarazuka Revue, adding more overt commentary on the role of theatre and actors, as well as gender as applied to the stage (made more layered by the fact that all roles in this production were played by women).
In 1910, Vitagraph Studios released the silent, short adaptation Twelfth Night starring actors Florence Turner, Julia Swayne Gordon and Marin Sais.
There was a 1986 Australian film.
The 1996 film adapted and directed by Trevor Nunn and set in the 19th century, stars Imogen Stubbs as Viola, Helena Bonham Carter as Olivia and Toby Stephens as Duke Orsino. The film also features Mel Smith as Sir Toby, Richard E. Grant as Sir Andrew, Ben Kingsley as Feste, Imelda Staunton as Maria and Nigel Hawthorne as Malvolio. Much of the comic material was downplayed into straightforward drama, and the film received some criticism for this.
The 2001 "Disney Channel Original Movie" "Motocrossed" sets the story in the world of motocross racing.
In the 2004 movie Wicker Park, Rose Byrne's character Alex plays Viola in an amateur production of Twelfth Night.
The 2006 film She's the Man modernises the story as a contemporary teenage comedy (as 10 Things I Hate About You did with The Taming of the Shrew). It is set in a prep school named Illyria and incorporates the names of the play's major characters. For example, Orsino, Duke of Illyria becomes simply Duke Orsino ("Duke" being his forename). The story was changed to revolve around the idea of soccer rivalry but the twisted character romance remained the same as the original. Viola, the main character, pretends to be her brother Sebastian, and a girl named Olivia falls in love with Viola as Sebastian. She also goes to restaurant named "Cesario's". Two of Duke's Illyria soccer teammates are named Andrew and Toby. A nod is given to the omitted subplot by naming a briefly-onscreen tarantula Malvolio. Several characters, such as Monique and Malcolm, do not seem to stem from any Shakespearean inspiration.
Shakespeare in Love contains several references to Twelfth Night. Near the end of the movie, Elizabeth I (Judi Dench) asks Shakespeare (Joseph Fiennes) to write a comedy for the Twelfth Night holiday. Shakespeare's love interest in the film, "Viola" (Gwyneth Paltrow), is the daughter of a wealthy merchant who disguises herself as a boy to become an actor; while Shakespeare, a financially struggling playwright suffering from writer's block is trying to write Romeo and Juliet. She is presented in the final scene of the film as William Shakespeare's "true" inspiration for the heroine of Twelfth Night. In a nod to the shipwrecked opening of Shakespeare's Twelfth Night, the movie includes a scene where the character Viola, separated from her love by an arranged marriage and bound for the American colonies, survives a shipwreck and comes ashore to Virginia.
The play was referenced in the movie V For Vendetta. The character V quotes: "Conceal me what I am, and be my aid... for such disguise as haply shall become the form of my intent" as he is dancing with Evey.
On 14 May 1937, the BBC Television Service in London broadcast a thirty-minute excerpt of the play, the first known instance of a work of Shakespeare being performed on television. Produced for the new medium by George More O'Ferrall, the production is also notable for having featured a young actress who would later go on to win an Academy Award – Greer Garson. As the performance was transmitted live from the BBC's studios at Alexandra Palace and the technology to record television programmes did not at the time exist, no visual record survives other than still photographs.
The entire play was produced for television in 1939, directed by Michel Saint-Denis and starring another future Oscar-winner, Peggy Ashcroft. The part of Sir Toby Belch was taken by a young George Devine.
In 1957, another adaptation of the play was presented by NBC on U.S. television's Hallmark Hall of Fame, with Maurice Evans recreating his performance as Malvolio. This was the first color version ever produced on TV. Dennis King, Rosemary Harris, and Frances Hyland co-starred.
In 1966 there was an Australian TV version.
Another version for UK television was produced in 1969, directed by John Sichel and John Dexter. The production featured Joan Plowright as Viola and Sebastian, Alec Guinness as Malvolio, Ralph Richardson as Sir Toby Belch and Tommy Steele as an unusually prominent Feste.
Yet another TV adaptation followed in 1980. This version was part of the BBC Television Shakespeare series and featured Felicity Kendal in the role of Viola, Sinéad Cusack as Olivia, Alec McCowen as Malvolio and Robert Hardy as Sir Toby Belch.
In 1988, Kenneth Branagh's stage production of the play, starring Frances Barber as Viola and Richard Briers as Malvolio, was adapted for Thames Television.
In 1998 the Lincoln Center Theater production directed by Nicholas Hytner was broadcast on PBS Live From Lincoln Center. It starred Helen Hunt as Viola, Paul Rudd as Orsino, Kyra Sedgwick as Olivia, Philip Bosco as Malvolio, Brian Murray as Sir Toby, Max Wright as Sir Andrew, and David Patrick Kelly as Feste.
A 2003 telemovie adapted and directed by Tim Supple is set in the present day. It features David Troughton as Sir Toby, and is notable for its multi-ethnic cast including Parminder Nagra as Viola and Chiwetel Ejiofor as Orsino. Its portrayal of Viola and Sebastian's arrival in Illyria is reminiscent of news footage of asylum seekers.
An episode of the British series Skins, entitled Grace, featured the main characters playing Twelfth Night, with a love triangle between Franky, Liv and Matty, who respectively played Viola, Olivia and Orsino.
An adaptation of Twelfth Night by Cathleen Nesbitt for the BBC was the first complete Shakespeare play ever broadcast on British radio. This occurred on 28 May 1923, with Nesbitt as both Viola and Sebastian, and Gerald Lawrence as Orsino.
In 1937 an adaptation was performed on the CBS Radio Playhouse starring Orson Welles as Orsino and Tallulah Bankhead as Viola. A year later, Welles played Malvolio in a production with his Mercury Theater Company.
There have been several full adaptations on BBC Radio. A 1982 BBC Radio 4 broadcast featured Alec McCowen as Orsino, Wendy Murray as Viola, Norman Rodway as Sir Toby Belch, Andrew Sachs as Sir Andrew Aguecheek, and Bernard Hepton as Malvolio; in 1993, BBC Radio 3 broadcast a version of the play (set on a Caribbean Island), with Michael Maloney as Orsino, Eve Matheson as Viola, Iain Cuthbertson as Malvolio, and Joss Ackland as Sir Toby Belch; this adaptation was broadcast again on 6 January 2011 by BBC Radio 7 (now Radio 4 Extra). 1998 saw another Radio 3 adaptation, with Michael Maloney, again as Orsino, Josette Simon as Olivia and Nicky Henson as Feste. In April 2012, BBC Radio 3 broadcast a version directed by Sally Avens, with Paul Ready as Orsino, Naomi Frederick as Viola, David Tennant as Malvolvio and Ron Cook as Sir Toby Belch.
In 1888, Alexander Campbell Mackenzie composed an overture based on Twelfth Night.
In 1942, Gerald Finzi set the songs "O Mistress Mine" (Act II, Scene 3) and "Come Away, Come Away, Death" (Act II, Scene 4) to music as part of his song cycle on Shakespearean texts Let Us Garlands Bring.
Roger Quilter set "O Mistress Mine" and "Come Away, Come Away, Death" in his Three Shakespeare Songs, Op. 6.
Swedish composer Sven-Eric Johanson's song cycle for mixed chorus and piano "Fancies I" includes a setting in waltz time of "O Mistress Mine" (1974).
The Danish philosopher Søren Kierkegaard opens his book Philosophical Fragments with the quote "Better well hanged than ill wed" which is a paraphrase of Feste's comment to Maria in Act 1, Scene 5: "Many a good hanging prevents a bad marriage". Nietzsche also refers passingly to Twelfth Night (specifically, to Sir Andrew Aguecheek's suspicion, expressed in Act 1, Scene 3, that his excessive intake of beef is having an inverse effect on his wit) in the third essay of his Genealogy of Morality.
The Kiddy Grade characters Viola and Cesario are named for Viola and her alter ego Cesario, respectively.
Elizabeth Hand's novella Illyria features a high school production of Twelfth Night, containing many references to the play, especially Feste's song.
One of Club Penguin's plays, Twelfth Fish, is a spoof of Shakespeare's works. It is a story about a countess, a jester, and a bard who catch a fish that talks. As the play ends, they begin eating the fish. Many of the lines are parodies of Shakespeare.
Agatha Christie's 1940 mystery novel Sad Cypress draws its title from a song in Act II, Scene IV of Twelfth Night.
American playwright Ken Ludwig wrote a play inspired by the details of Twelfth Night, called Leading Ladies.
Cassandra Clare's 2009 novel City of Glass contains chapter names inspired by quotations of Antonio and Sebastian.
Two of the dogs in the film Hotel for Dogs are twins called Sebastian and Viola.
Clive Barker's short story "Sex, Death and Starshine" revolves around a doomed production of Twelfth Night.
The Baker Street Irregulars believe Sherlock Holmes's birthday to be January 6 due to the fact that Holmes quotes twice from Twelfth Night whereas he quotes only once from other Shakespeare plays.