Mary was born at St. James Palace in London on 30 April 1662. Her father was James, Duke of York, and her mother was his first wife, Lady Anne Hyde. She was their oldest daughter. Mary's uncle was Charles II. Her grandfather by her mother's side was Edward Hyde, 1st Earl of Clarendon. He served for a long time as Charles's chief advisor. Her mother gave birth to eight children, but only Mary and her younger sister Anne lived to adulthood.