The play begins in the flat of wealthy Algernon Moncrieff (Algy) in London's fashionable West End. Algernon's aunt (Lady Bracknell) and her daughter (Gwendolen Fairfax) are coming for a visit, but Mr. Jack Worthing (a friend of Algy's) arrives first. Algernon finds it curious that Jack has announced himself as "Ernest." When Jack explains that he plans to propose marriage to Gwendolen, Algy demands to know why Jack has a cigarette case with the inscription, "From little Cecily with her fondest love." Jack explains that his real name is Jack Worthing, squire, in the country, but he assumes the name "Ernest" when he ventures to the city for fun. Cecily is his ward. While devouring all the cucumber sandwiches, Algernon confesses that he, too, employs deception when it's convenient. He visits an imaginary invalid friend named Bunbury when he needs an excuse to leave the city.
Lady Bracknell and Gwendolen arrive. Algernon explains that he cannot attend Lady Bracknell's reception because he must visit his invalid friend, Bunbury, but he offers to arrange the music for her party. While Algernon distracts Lady Bracknell in another room, Jack proposes to Gwendolen. Unfortunately, she explains that she really wants to marry someone named Ernest because it sounds so solidly aristocratic. However, she accepts his proposal, and he makes a mental note to be rechristened Ernest. Lady Bracknell returns and refutes the engagement. She interrogates Jack and finds him lacking in social status. On her way out, Lady Bracknell tells Jack that he must find some acceptable parents. Gwendolen returns for Jack's address in the country. Algernon overhears and writes the address on his shirt cuff. He is curious about Cecily and decides to go "bunburying" in the country.
In the second act, the scene shifts to Jack Worthing's country estate where Miss Prism, Cecily Cardew's governess, is teaching Cecily in the garden. Miss Prism sings Jack's praises as a sensible and responsible man, unlike his brother Ernest, who is wicked and has a weak character. She teaches Cecily that good people end happily, and bad people end unhappily, according to the romantic novel Miss Prism wrote when she was young. The local vicar, Canon Chasuble, arrives and, sensing an opportunity for romance, takes Miss Prism for a walk in the garden. While they are gone, Algy shows up pretending to be Jack's wicked brother Ernest. He is overcome by Cecily's beauty. Determined to learn more about Cecily while Jack is absent, Algernon plans to stay for the weekend, then make a fast getaway before Jack arrives on Monday. However, Jack returns early in mourning clothes claiming that his brother Ernest has died in Paris. He is shocked to find Algy there posing as Ernest. He orders a dogcart — a small horse-drawn carriage — to send Algy back to London, but it is too late. Algernon is in love with Cecily and plans to stay there. When Jack goes out, Algernon proposes to Cecily, who gets out a diary and letters that she has already written, explaining that she had already imagined their engagement. She has always wanted to marry someone named Ernest, so Algy, like Jack, needs to arrange a rechristening.
Just when it seems that Jack and Algernon couldn't get into worse trouble, Gwendolen arrives, pursuing Jack, and discovers that his ward, Cecily, is unpleasantly beautiful. In conversation, they discover that they are both engaged to Ernest Worthing. A battle follows, cleverly carried out during the British tea ceremony. The situation is tense. Jack and Algernon arrive, and, in attempting to straighten out the Ernest problem, they alienate both women. The two men follow, explaining that they are going to be rechristened Ernest, and the women relent and agree to stay engaged.
Lady Bracknell shows up demanding an explanation for the couples' plans. When she discovers the extent of Cecily's fortune, she gives her consent to her engagement to Algernon; however, Jack's parentage is still a stumbling block to her blessings. Jack tells Lady Bracknell that he will not agree to Cecily's engagement until she is of age (35) unless he can marry Gwendolen. Dr. Chasuble arrives and announces that all is ready for the christenings. Jack explains that the christenings will no longer be necessary. Noting that Jack's present concerns are secular, the minister states that he will return to the church where Miss Prism is waiting to see him. Shocked at hearing the name "Prism," Lady Bracknell immediately calls for Prism and reveals her as the governess who lost Lady Bracknell's nephew 28 years earlier on a walk with the baby carriage. She demands to know where the baby is. Miss Prism explains that in a moment of distraction she placed the baby in her handbag and left him in Victoria Station, confusing him with her three-volume novel, which was placed in the baby carriage. After Jack asks for details, he quickly runs to his room and retrieves the handbag. Miss Prism identifies it, and Lady Bracknell reveals that Jack is Algernon's older brother, son of Ernest John Moncrieff, who died years ago in India. Jack now truly is Ernest, and Algernon/Cecily, Jack/Gwendolen, and Chasuble/Prism fall into each others' arms as Jack realizes the importance of being earnest.