Madame Bovary takes place in provincial northern France, near the town of Rouen in Normandy. Charles Bovary is a shy, oddly dressed teenager arriving at a new school where his new classmates ridicule him. Charles struggles his way to a second-rate medical degree and becomes an officier de sant  in the Public Health Service. He marries the woman his mother has chosen for him, the unpleasant but supposedly rich widow Heloise Dubuc. He sets out to build a practice in the village of Tostes (now T tes).
One day, Charles visits a local farm to set the owner's broken leg and meets his patient's daughter, Emma Rouault. Emma is a beautiful, daintily dressed young woman who has received a "good education" in a convent. She has a powerful yearning for luxury and romance inspired by reading popular novels. Charles is immediately attracted to her and visits his patient far more often than necessary until Heloise's jealousy puts a stop to the visits. When Heloise dies, Charles waits a decent interval before courting Emma in earnest. Her father gives his consent, and Emma and Charles marry.
The novel's focus shifts to Emma. Charles means well but is plodding and clumsy. After he and Emma attend an elegant ball given by the Marquis d'Andervilliers, Emma finds her married life dull and becomes listless. Charles decides his wife needs a change of scenery and moves his practice to the larger market town of Yonville (traditionally identified with the town of Ry). There, Emma gives birth to a daughter, Berthe, but motherhood proves a disappointment to Emma. She becomes infatuated with an intelligent young man she meets in Yonville, a young law student, L on Dupuis, who shares her appreciation for literature and music and returns her esteem. Concerned with maintaining her self-image as a devoted wife and mother, Emma does not acknowledge her passion for L on and conceals her contempt for Charles, drawing comfort from the thought of her virtue. L on despairs of gaining Emma's affection and departs to study in Paris.
One day, a rich and rakish landowner, Rodolphe Boulanger, brings a servant to the doctor's office to be bled. He casts his eye over Emma and imagines she will be easily seduced. He invites her to go riding with him for the sake of her health. Charles, solicitous for his wife's health and not at all suspicious, embraces the plan. Emma and Rodolphe begin an affair. She, consumed by her romantic fantasy, risks compromising herself with indiscreet letters and visits to her lover. After four years, she insists they run away together. Rodolphe does not share her enthusiasm for this plan and on the eve of their planned departure, he ends the relationship with an apologetic, self-effacing letter placed at the bottom of a basket of apricots he has delivered to Emma. The shock is so great that Emma falls deathly ill and briefly turns to religion.
When Emma is nearly fully recovered, she and Charles attend the opera, at Charles' insistence, in nearby Rouen. The opera reawakens Emma's passions, and she encounters L on who, now educated and working in Rouen, is also attending the opera. They begin an affair. While Charles believes that she is taking piano lessons, Emma travels to the city each week to meet L on, always in the same room of the same hotel, which the two come to view as their home. The love affair is ecstatic at first, but L on grows bored with Emma's emotional excesses, and Emma grows ambivalent about L on. Emma indulges her fancy for luxury goods with purchases made on credit from the crafty merchant Lheureux, who arranges for her to obtain power of attorney over Charles' estate. Emma's debt steadily mounts.
When Lheureux calls in Bovary's debt, Emma pleads for money from several people, including L on and Rodolphe, only to be turned down. In despair, she swallows arsenic and dies an agonizing death. Charles, heartbroken, abandons himself to grief, preserves Emma's room as a shrine, and adopts her attitudes and tastes to keep her memory alive. In his last months, he stops working and lives by selling off his possessions. When he finds Rodolphe and L on's love letters, he still tries to understand and forgive her. His remaining possessions are seized to pay off Lheureux. He dies, and his young daughter Berthe is placed with her grandmother, who soon dies. Berthe then lives with an impoverished aunt, who sends her to work in a cotton mill. The book concludes with the local pharmacist Homais, who had competed with Charles's medical practice, gaining prominence among Yonville people and being awarded for his medical achievements.
Output: What is the gender of Emma's child?