Mary, born at St James's Palace in London on 30 April 1662, was the eldest daughter of James, Duke of York (the future James II & VII), and his first wife, Anne Hyde.
From about the age of nine until her marriage, Mary wrote passionate letters to an older girl, Frances Apsley, the daughter of courtier Sir Allen Apsley.