The play is set in "The Present" (i.e. 1895).
- Algernon Moncrieff's flat in Half Moon Street, W
The play opens with Algernon Moncrieff, an idle young gentleman, receiving his best friend, John Worthing, whom he knows as Ernest. Ernest has come from the country to propose to Algernon's cousin, Gwendolen Fairfax. Algernon, however, refuses his consent until Ernest explains why his cigarette case bears the inscription, "From little Cecily, with her fondest love to her dear Uncle Jack." 'Ernest' is forced to admit to living a double life. In the country, he assumes a serious attitude for the benefit of his young ward, the heiress Cecily Cardew, and goes by the name of John (or, as a nickname, Jack), while pretending that he must worry about a wastrel younger brother named Ernest in London. In the city, meanwhile, he assumes the identity of the libertine Ernest. Algernon confesses a similar deception: he pretends to have an invalid friend named Bunbury in the country, whom he can "visit" whenever he wishes to avoid an unwelcome social obligation. Jack refuses to tell Algernon the location of his country estate.
Gwendolen and her formidable mother Lady Bracknell now call on Algernon who distracts Lady Bracknell in another room while Jack proposes to Gwendolen. She accepts, but seems to love him very largely for his professed name of Ernest. Jack accordingly resolves to himself to be rechristened "Ernest". Discovering them in this intimate exchange, Lady Bracknell interviews Jack as a prospective suitor. Horrified to learn that he was adopted after being discovered as a baby in a handbag [n 9] at Victoria Station, she refuses him and forbids further contact with her daughter. Gwendolen, though, manages covertly to promise to him her undying love. As Jack gives her his address in the country, Algernon surreptitiously notes it on the cuff of his sleeve: Jack's revelation of his pretty and wealthy young ward has motivated his friend to meet her.
- The Garden of the Manor House, Woolton
Cecily is studying with her governess, Miss Prism. Algernon arrives, pretending to be Ernest Worthing, and soon charms Cecily. Long fascinated by Uncle Jack's hitherto absent black sheep brother, she is predisposed to fall for Algernon in his role of Ernest (a name she, like Gwendolen, is apparently particularly fond of). Therefore Algernon, too, plans for the rector, Dr. Chasuble, to rechristen him "Ernest".
Jack, meanwhile, has decided to abandon his double life. He arrives in full mourning and announces his brother's death in Paris of a severe chill, a story undermined by Algernon's presence in the guise of Ernest.
Gwendolen now enters, having run away from home. During the temporary absence of the two men, she meets Cecily, each woman indignantly declaring that she is the one engaged to "Ernest". When Jack and Algernon reappear, their deceptions are exposed.
- Morning-Room at the Manor House, Woolton
Arriving in pursuit of her daughter, Lady Bracknell is astonished to be told that Algernon and Cecily are engaged. The revelation of Cecily's trust fund soon dispels Lady Bracknell's initial doubts over the young lady's suitability, but any engagement is forbidden by her guardian Jack: he will consent only if Lady Bracknell agrees to his own union with Gwendolen—something she declines to do.
The impasse is broken by the return of Miss Prism, whom Lady Bracknell recognises as the person who, twenty-eight years earlier, as a family nursemaid, had taken a baby boy for a walk in a perambulator (baby carriage) and never returned. Challenged, Miss Prism explains that she had absentmindedly put the manuscript of a novel she was writing in the perambulator, and the baby in a handbag, which she had left at Victoria Station. Jack produces the very same handbag, showing that he is the lost baby, the elder son of Lady Bracknell's late sister, and thus indeed Algernon's elder brother. Having acquired such respectable relations, he is acceptable as a suitor for Gwendolen after all.
Gwendolen, though, still insists that she can only love a man named Ernest. What is her fiancé's real first name? Lady Bracknell informs Jack that, as the first-born, he would have been named after his father, General Moncrieff. Jack examines the army lists and discovers that his father's name—and hence his own real name—was in fact Ernest. Pretence was reality all along. As the happy couples embrace—Jack and Gwendolen, Algernon and Cecily, and even Dr. Chasuble and Miss Prism—Lady Bracknell complains to her newfound relative: "My nephew, you seem to be displaying signs of triviality." "On the contrary, Aunt Augusta", he replies, "I've now realised for the first time in my life the vital importance of being Earnest."