The novel opens with Michael Henchard and his wife, Susan, traveling through the country with their baby daughter, Elizabeth-Jane. They stop for supper and Henchard gets totally drunk on rum. He offers to sell his wife and daughter to the highest bidder. He isn't entirely serious, but when a sailor offers five guineas (a lot of money to a poor man back then), Henchard takes it. Susan thinks it's a binding arrangement and that she now legally belongs to the sailor, so she takes the baby and leaves.
When Henchard wakes up sober and sorry, he tries to trace his wife and daughter. No luck. He swears a solemn oath not to drink any more alcohol for twenty years. After several months, he learns that the sailor has probably taken Susan and Elizabeth-Jane to North America, and he gives up hope of ever finding them. He settles down in the town of Casterbridge.
The scene changes. It's eighteen years later. Susan and her daughter, Elizabeth-Jane, are traveling to Casterbridge to track down Michael Henchard. The sailor, whose name was Newson, has died, and Susan (who now calls herself Mrs. Newson, since she thought that her marriage was actually legally transferred to Newson) has decided that it's only right to return to her first husband to see if he can do anything for Elizabeth-Jane.
When they arrive in Casterbridge, they find that Henchard has worked his way up from a lowly hay harvester to a hay and grain merchant. He's wealthy now and has even been elected Mayor of the town. When he learns that Susan and Elizabeth-Jane are not only still alive, but in Casterbridge, he decides that it's only right to take them in and support them. But, as you might guess, he doesn't want to admit to anyone that he auctioned off his wife eighteen years earlier. So he suggests that Susan live in Casterbridge and call herself the widow Mrs. Newson, and he'll pretend to fall in love with her and propose to marry her. Then they can all live together, with Elizabeth-Jane as his "stepdaughter" instead of as his real daughter. Susan agrees, they follow the plan, and Susan and Elizabeth-Jane are soon living in the Mayor's house.
Around this same time, Henchard hires a young Scottish man, Donald Farfrae, to help manage his affairs. Farfrae has a much better head for business than Henchard does, and he quickly whips Henchard's business into shape. The two men become friends, and Elizabeth-Jane develops a crush on Farfrae.
Henchard confides everything to Farfrae, including the drunken auction eighteen years earlier. He even admits to him that before Susan and Elizabeth-Jane showed up, he had had a romantic entanglement with a young lady from Jersey (the British one, not the one with the Shore). The young lady was head over heels in love with him and didn't hide it, and everyone assumed they'd been sleeping together. They hadn't, but her reputation was ruined anyway. She wanted him to marry her to save her reputation, and he was going to – until Susan showed up. Farfrae is sympathetic when he hears the story and feels sorry for the other girl. Still, he agrees that Henchard did the right thing by remarrying his original wife.
Then things start to unravel. Henchard becomes jealous of Farfrae because the employees like him better. He fires Farfrae, who starts up his own business across town and does really well. Then Susan dies. Henchard tells Elizabeth-Jane that she's his real daughter, saying that he and Susan had been "separated" from each other for a long time (he doesn't admit to having auctioned them off).
But then he reads a letter that Susan left for him before her death admitting that Elizabeth-Jane isn't his real daughter. She's actually the daughter of Captain Newson, and the original Elizabeth-Jane (the baby who was auctioned off along with Susan) died as a baby. Crazy, huh?! Henchard decides he doesn't really want Elizabeth-Jane around anymore and starts being mean to her.
And the drama continues. Elizabeth-Jane moves out of Henchard's house to live with a wealthy young woman who has just moved to Casterbridge. Turns out, that young woman is the one who was in love with Henchard before! Her name is Lucetta, but she changed her last name from Le Sueur to Templeman after inheriting a lot of money from a wealthy aunt named Miss Templeman. She has moved to Casterbridge because she heard of Susan's death and still wants Henchard to marry her. Henchard feels guilty about having messed up her reputation (even though he still swears they never slept together) so he's all for marrying her.
But then Lucetta meets Farfrae. Lucetta is a total flirt and Farfrae falls for her. Lucetta doesn't want to marry Henchard anymore, but she's worried that someone will find out about her past relationship with him. She'd written him a lot of steamy love letters and is worried that someone might show them to Farfrae. Henchard is angry that she doesn't want to marry him anymore, and he tries to blackmail her into promising to be his wife. Lucetta panics, then marries Farfrae on the sly. Farfrae knows nothing about Lucetta's past relationship with Henchard and has no clue why Henchard, who used to be his best friend, is acting like such a jerk.
Henchard's business has been failing ever since Farfrae stopped working for him, and finally he has to declare bankruptcy. Farfrae buys Henchard's house and business. Henchard ends up being hired to work for Farfrae as a lowly laborer, which really hurts his pride. He is still jealous of Farfrae and is tempted to show him Lucetta's old love letters as a way of getting back at them both.
Lucetta tries to persuade Henchard to give her all the old love letters so that she can burn them. Henchard reluctantly agrees. But he sends the letters in a package with someone who isn't trustworthy. The messenger opens the package and shows the letters to a few people in a bar. The rumors about Lucetta's past relationship with Henchard start flying around. A few drunken townspeople decide it would be funny to have a parade with a model of Henchard and Lucetta cuddling together. They have their drunken procession one night while Farfrae is out of town. Lucetta hears about it and is so upset that she gets hysterical and then dies. The drunken townspeople feel kind of bad about that. They didn't mean to kill her.
Henchard realizes that he's been a total jerk to Elizabeth-Jane and apologizes. Elizabeth-Jane moves back in with him, still thinking she's his real daughter and that Captain Newson, the man who brought her up, was only her stepfather. Then one day, while Elizabeth-Jane is taking a nap, Captain Newson shows up at Henchard's door. (Wait, we thought he was dead!) Turns out that Newson hadn't really drowned when Susan thought he did. He asks about Elizabeth-Jane. Henchard is afraid that Newson will tell Elizabeth-Jane that he's her real father and that she'll leave. So Henchard lies and says Elizabeth-Jane is dead. Newson leaves town immediately, but Henchard is paranoid that Newson will return and Elizabeth-Jane will find out about his big fat lie.
After Lucetta's death, Farfrae is at first heartbroken, but then he begins to realize that a much better woman than Lucetta has been there this whole time. Elizabeth-Jane still loves him, and they start thinking about getting married. Henchard has been uneasy ever since Newson's visit, and now that Elizabeth-Jane is going to get married, he decides he should just leave Casterbridge altogether. But he can't bring himself to go too far away from Elizabeth-Jane – he wanders around the countryside near Casterbridge for weeks.
Newson returns soon after Henchard leaves and tells Elizabeth-Jane the truth. She is understandably angry at Henchard for having lied to her about being her real father and for send Newson away. After she gets married, though, she starts to feel sorry for her stepfather. She searches for him but only finds him after he has died.