Before the 1939 invasion of Poland by Nazi Germany, the stars of a theater company in Warsaw are the "ham" Josef Tura (Jack Benny) and his beautiful wife, Maria (Carole Lombard). As part of the company's rehearsal of a play satirizing the Nazis, one of the actors, Bronski (Tom Dugan), takes to the street to prove that he looks like Hitler in his costume and makeup. People gawk at the appearance of the Nazi dictator in Warsaw, until a young girl asks for the autograph of "Mr. Bronski."
That night, when the company is performing Shakespeare's Hamlet, with Tura in the title role, Bronski commiserates with his friend and colleague, Greenberg (Felix Bressart), about being limited to being spear carriers. Greenberg reveals that it has always been his dream to perform Shylock inMerchant of Venice, especially the famous "Hath not a Jew eyes?..." speech.
Meanwhile, Maria has received a bouquet of flowers from the handsome young pilot Lt. Stanislav Sobinski (Robert Stack). She arranges to meet him, telling Sobinski to come to her dressing room when Tura begins his "To be or not to be..." speech, so they can be sure of privacy. The young man walks out, very obviously, when Tura begins his monologue, causing the highly-strung actor great distress. Sobinski and Maria begin to see each other, but soon after Germany declares war on Poland, Sobinski leaves to join the fight.
Hitler conquers Poland, and the Polish division of the British Royal Air Force is fighting to free its mother country. Lt. Sobinski and other young pilots of the division sing together, with the Polish resistance leader Professor Siletsky (Stanley Ridges) as their guest. Siletsky hints he will return to Warsaw soon, and the men jump to give him messages for their relatives, but Sobinski is suspicious when he gives Siletsky a message for Maria Tura and he doesn't know who the famous actress is. When Sobinski reports the incident to higher authorities, they realize that Siletsky now has a list of the names and addresses of relatives of Polish airmen in the RAF, against whom reprisals can be taken.
Sobinski is sent to Warsaw to warn the resistance, but Siletsky gets there before him. The flier manages to reach Maria, who passes on the message to the underground. Immediately after, she is stopped by two soldiers, who have been ordered by Siletsky to bring her to him so he can deliver Sobinski's message and determine what "To be or not to be" means to her. Siletsky invites Maria to dinner, hoping to recruit her as a spy, as well as to sample her charms. She pretends to be interested and goes home to dress more appropriately for the occasion. Just before she arrives at her apartment, Tura returns and finds Sobinski in his bed and his bathrobe. Maria and Sobinski try to figure out what to do about Siletsky, while Tura tries to figure out what is going on with his wife and the pilot. In the end, Tura proclaims that he will kill Siletsky.
Later that evening, Maria returns to Siletsky's room and pretends to be attracted to him. Just as they kiss, there is a knock at the door. A Nazi officer – actually one of the members of the acting company – summons Siletsky to "Gestapo headquarters", which is the theatre, hastily disguised with props and costumes from their play.
Tura pretends to be Col. Ehrhardt of the Gestapo, and Siletsky gives him the report containing the names and addresses of the families of the Polish pilots. He also reveals that Sobinski gave him a message for Maria, and that "To be or not to be" was the signal for their rendezvous. Tura reacts in an extremely jealous way and declares he will have Maria arrested. Noting this overreaction, Siletsky quickly sees that he has been duped, pulls a gun on Tura and tries to escape, but is shot and killed by Sobinski. Tura returns to the hotel disguised as Siletsky in a fake beard and glasses, to destroy the copy of the information about the Polish resistance that Siletsky has in his trunk. Unfortunately, he's met at the hotel by the real Col. Ehrhardt's adjutant, Capt. Schultz (Henry Victor), and taken to meet Ehrhardt himself (Sig Ruman). Tura manages to pass himself off as Siletsky, and learns that Hitler himself will visit Warsaw the next day.
The next day, the real Siletsky's body is discovered in the theater. Ehrhardt sends for Maria to tell her, but she is unable to warn Tura in time, and he arranges another meeting with Ehrhardt, again posing as Siletsky. When Tura arrives, Ehrhardt sends him into a room with Siletsky's dead body, hoping to frighten him into a confession. Thinking quickly, Tura shaves off Siletsky's beard and then attaches a spare fake beard that he was carrying in his pocket. He then calls Ehrhardt into the room and manipulates him into pulling Siletsky's now-fake beard off. This appears to prove that the real Siletsky was actually the imposter, but just as Tura is about to make his escape, the other actors, sent by Maria and again in Nazi costume, storm into Ehrhardt's office, yank off Tura's false beard and pretend to drag him away to prison. This gets Tura out of Gestapo headquarters, but now he cannot leave the country on the plane Ehrhardt had arranged for him, and it's only a matter of time before the ruse is discovered.
The company now comes up with a bold plan. The Nazis stage a show at the theater to honor Hitler, and Sobinski and the actors sneak in dressed as Nazis. Among them is Bronski, initially without his Hitler mustache. The actors hide until Hitler arrives and takes his seat, and then, as the Nazis are singing the German national anthem inside, Greenberg suddenly appears. This distracts the Führer's guards long enough for Bronski, now wearing a Hitler mustache, to emerge unnoticed from hiding, surrounded by his entourage of actors dressed as Nazi officers.
Playing the head of Hitler's guard, Tura demands to know what Greenberg wants, and the actor finally gets his chance to deliver Shylock's famous speech from The Merchant of Venice. He ends with a ringing "if you wrong us, shall we not revenge?!" and Tura orders his "officers" to take Greenberg away. He also recommends that Bronski/Hitler leave Poland immediately, and all the actors march out, get in Hitler's cars and drive away.
Back at her apartment, Maria is waiting for the actors to pick her up. They all intend to leave on Hitler's plane, but Col. Ehrhardt shows up and tries to seduce her. Ehrhardt is amazed, however, when the door opens and Bronski walks in disguised as Hitler. Bronski simply turns and walks out in silence, but Ehrhardt immediately thinks that Maria is having an affair with Hitler and he has just been caught trying to steal the Führer's mistress. Maria dashes after Bronski calling, "Mein Führer, Mein Führer!"
All the actors take off in the plane. They easily dispose of the Nazi pilots, and Sobinski flies the plane to Scotland, where the actors are interviewed by the press. Asked what reward he'd like for his service to the Allies, Tura hesitates in a show of false modesty, but Maria quickly responds for him, "He wants to play Hamlet."
Tura is now once again on stage as Hamlet and reaches the moment of "To be or not to be." He sees Sobinski in the audience as he begins the speech, but both are amazed when a new young officer gets up and noisily heads backstage.
Lubitsch had never considered anyone other than Jack Benny for the lead role in the film. He had even written the character with Benny in mind. Benny, thrilled that a director of Lubitsch's caliber had been thinking of him while writing it, accepted the role immediately. Benny was in a predicament as, strangely enough, his success in Charley's Aunt was not interesting anyone in hiring the actor for their films.
For Benny's costar, the studio and Lubitsch decided on Miriam Hopkins, whose career had been faltering in recent years. The role was designed as a comeback for the veteran actress, but Hopkins and Benny did not get along well, and Hopkins left the production.
Lubitsch was left without a leading lady until Carole Lombard, hearing his predicament, asked to be considered. Lombard had never worked with the famous director and yearned to have an opportunity. Lubitsch agreed and Lombard was cast. The film also provided Lombard with an opportunity to work with friend Robert Stack, whom she had known since he was an awkward teenager. The film was shot at United Artists, which allowed Lombard to say that she had worked at every major studio in Hollywood.
To Be or Not To Be, now regarded as one of the best films of Lubitsch's, Benny's and Lombard's careers, was initially not well received by the public, many of whom could not understand the notion of making fun out of such a real threat as the Nazis. According to Jack Benny's memoirs, his own father walked out of the theater early in the film, disgusted that his son was in a Nazi uniform, and vowed not to set foot in the theater again. Benny convinced him otherwise and his father ended up loving the film, and saw it forty-six times.
The same could not be said for the critics, however. While they generally praised Lombard, many scorned Benny and Lubitsch. To one critic Lubitsch wrote, "What I have satirized in this picture are the Nazis and their ridiculous ideology. I have also satirized the attitude of actors who always remain actors regardless of how dangerous the situation might be, which I believe is a true observation. It can be argued if the tragedy of Poland realistically portrayed as in To Be or Not to Be can be merged with satire. I believe it can be and so do the audience which I observed during a screening of To Be or Not to Be; but this is a matter of debate and everyone is entitled to his point of view, but it is certainly a far cry from the Berlin-born director who finds fun in the bombing of Warsaw." The critic Mildred Martin reviewed another of Lubitsch's films and referred derogatively to his German birth and his comedy about Nazis in Poland.
Some critics were especially offended by Colonel Ehrhardt's line: "Oh, yes I saw him [Tura] in 'Hamlet' once. What he did to Shakespeare we are doing now to Poland." However, the film has since become a comedy classic.
To Be or Not To Be has a 97% approval rating on the review aggregator website Rotten Tomatoes with an average rating of 8,7, based on 36 reviews, with the consensus: "A complex and timely satire with as much darkness as slapstick, Ernst Lubitsch's To Be or Not To Be delicately balances humor and ethics."