Macmillan married Lady Dorothy Cavendish, the daughter of the 9th Duke of Devonshire, on 21 April 1920. Her great-uncle was Spencer Cavendish, 8th Duke of Devonshire, who was leader of the Liberal Party in the 1870s, and a close colleague of William Ewart Gladstone, Joseph Chamberlain and Lord Salisbury. Lady Dorothy was also descended from William Cavendish, 4th Duke of Devonshire, who served as Prime Minister from 1756 to 1757 in communion with Newcastle and Pitt the Elder. Her nephew William Cavendish, Marquess of Hartington, married Kathleen Kennedy, a sister of John F. Kennedy.
In 1929 Lady Dorothy began a lifelong affair with the Conservative politician Robert Boothby, an arrangement that scandalised high society but remained unknown to the general public. Philip Frere, a partner in Frere Cholmely solicitors, urged Macmillan not to divorce his wife, which at that time would have been fatal to a public career even for the "innocent party". Macmillan and Lady Dorothy lived largely separate lives in private thereafter. The stress caused by this may have contributed to Macmillan's nervous breakdown in 1931. He was often treated with condescension by his aristocratic in-laws and was observed to be a sad and isolated figure at Chatsworth in the 1930s. Campbell suggests that Macmillan's humiliation was first a major cause of his odd and rebellious behaviour in the 1930s then, in subsequent decades, made him a harder and more ruthless politician than his rivals Eden and Butler.
The Macmillans had four children:
Lady Dorothy died on 21 May 1966, aged 65, after 46 years of marriage.
Macmillan was in close friendship in old age with Ava Anderson, Viscountess Waverley, née Bodley (1896–1973), the widow of John Anderson, 1st Viscount Waverley.
Eileen O'Casey, née Reynolds (1900–95), the actress wife of Irish dramatist Seán O'Casey, was another female friend, Macmillan publishing her husband's plays. Although she is said to have replaced Lady Dorothy in Macmillan's affections, there is disagreement over how intimate they became after the death of their respective spouses, and whether he proposed.