The Mayor of Casterbridge: The Life and Death of a Man of Character is an 1886 novel by British author Thomas Hardy. It is set in the fictional town of Casterbridge (based on the town of Dorchester in Dorset). The book is one of Hardy's Wessex novels, all set in a fictional rural England.
Hardy began writing the book in 1884 and wrote the last page on 17 April 1885. Within the book, he writes that the events took place "before the nineteenth century had reached one-third of its span". Literary critic Dale Kramer sees it as being set somewhat later—in the late 1840s, corresponding to Hardy's youth in Dorchester.