Thomas Hardy was born in 1840 in Higher Bockhampton (Upper Bockhampton in his day), a hamlet in the parish of Stinsford to the east of Dorchester in Dorset, England, where his father Thomas (1811-1892) worked as a stonemason and local builder. His mother Jemima (née Hand; 1813-1904) was well-read, and she educated Thomas until he went to his first school at Bockhampton at age eight. For several years he attended Mr. Last's Academy for Young Gentlemen in Dorchester. Here he learned Latin and demonstrated academic potential. Because Hardy's family lacked the means for a university education, his formal education ended at the age of sixteen, when he became apprenticed to James Hicks, a local architect. Hardy trained as an architect in Dorchester before moving to London in 1862; there he enrolled as a student at King's College London. He won prizes from the Royal Institute of British Architects and the Architectural Association. Hardy was in charge of the excavation of the graveyard of St Pancras Old Church prior to its destruction when the Midland Railway was extended to a new terminus at St Pancras.
But Hardy never felt at home in London, because he was acutely conscious of class divisions and his social inferiority. However, during this time he became interested in social reform and the works of John Stuart Mill. He was also introduced by his Dorset friend Horace Moule to the works of Charles Fourier and Auguste Comte. Five years later, concerned about his health, he returned to Dorset, settling at Weymouth, and decided to dedicate himself to writing.
In 1870, while on an architectural mission to restore the parish church of St Juliot in Cornwall, Hardy met and fell in love with Emma Lavinia Gifford, whom he married in 1874. In 1885 Thomas and his wife moved into Max Gate, a house Hardy had designed himself and his brother had built. Although they later became estranged, her subsequent death in 1912 had a traumatic effect on him and after her death, Hardy made a trip to Cornwall to revisit places linked with their courtship; his Poems 1912–13 reflect upon her death. In 1914, Hardy married his secretary Florence Emily Dugdale, who was 39 years his junior. However, he remained preoccupied with his first wife's death and tried to overcome his remorse by writing poetry. In 1910, Hardy had been awarded the Order of Merit and was also for the first time nominated for the Nobel Prize in Literature. He would be nominated for the prize in eleven more years.
Hardy became ill with pleurisy in December 1927 and died at Max Gate just after 9 pm on 11 January 1928, having dictated his final poem to his wife on his deathbed; the cause of death was cited, on his death certificate, as "cardiac syncope", with "old age" given as a contributory factor. His funeral was on 16 January at Westminster Abbey, and it proved a controversial occasion because Hardy had wished for his body to be interred at Stinsford in the same grave as his first wife, Emma. His family and friends concurred; however, his executor, Sir Sydney Carlyle Cockerell, insisted that he be placed in the abbey's famous Poets' Corner. A compromise was reached whereby his heart was buried at Stinsford with Emma, and his ashes in Poets' Corner.
Shortly after Hardy's death, the executors of his estate burnt his letters and notebooks, but twelve documents survived, one of them containing notes and extracts of newspaper stories from the 1820s, and research into these has provided insight into how Hardy used them in his works. In the year of his death Mrs Hardy published The Early Life of Thomas Hardy, 1841–1891, compiled largely from contemporary notes, letters, diaries, and biographical memoranda, as well as from oral information in conversations extending over many years.
Hardy's work was admired by many younger writers, including D. H. Lawrence, John Cowper Powys, and Virginia Woolf. In his autobiography Goodbye to All That (1929), Robert Graves recalls meeting Hardy in Dorset in the early 1920s and how Hardy received him and his new wife warmly, and was encouraging about his work.
Hardy's birthplace in Bockhampton and his house Max Gate, both in Dorchester, are owned by the National Trust.