Anne was born in the reign of her uncle Charles II, who had no legitimate children. Her father, Charles's younger brother James, was thus heir presumptive to the throne. His suspected Roman Catholicism was unpopular in England, and on Charles's instructions Anne and her elder sister, Mary, were raised as Anglicans. Three years after he succeeded Charles upon the latter's death, James was deposed in the Glorious Revolution of 1688. Anne's sister and Dutch Protestant brother-in-law and cousin William III of Orange became joint monarchs. Although the sisters had been close, disagreements over Anne's finances, status and choice of acquaintances arose shortly after Mary's accession and they became estranged. William and Mary had no children. After Mary's death in 1694, William reigned alone until his own death in 1702, when Anne succeeded him.
During her reign, Anne favoured moderate Tory politicians, who were more likely to share her Anglican religious views than their opponents, the Whigs. The Whigs grew more powerful during the course of the War of the Spanish Succession, until 1710 when Anne dismissed many of them from office. Her close friendship with Sarah Churchill, Duchess of Marlborough, turned sour as the result of political differences. The Duchess took revenge in an unflattering description of the Queen in her memoirs, which was widely accepted by historians until Anne was re-assessed in the late 20th century.
Anne was plagued by ill health throughout her life, and from her thirties, she grew increasingly lame and obese. Despite seventeen pregnancies by her husband, Prince George of Denmark, she died without surviving issue and was the last monarch of the House of Stuart. Under the Act of Settlement 1701, which excluded all Catholics, she was succeeded by her second cousin George I of the House of Hanover, whose maternal grandmother, Elizabeth Stuart, Queen of Bohemia, was a daughter of James VI and I.
Anne was born at 11:39 p.m. on 6 February 1665 at St James's Palace, London, the fourth child and second daughter of the Duke of York (afterwards James II and VII), and his first wife, Anne Hyde. Her father was the younger brother of King Charles II, who ruled the three kingdoms of England, Scotland and Ireland, and her mother was the daughter of Lord Chancellor Edward Hyde, 1st Earl of Clarendon. At her Anglican baptism in the Chapel Royal at St James's, her older sister, Mary, was one of her godparents, along with the Duchess of Monmouth and the Archbishop of Canterbury, Gilbert Sheldon. The Duke and Duchess of York had eight children, but Anne and Mary were the only ones to survive into adulthood.
As a child, Anne suffered from an eye condition, which manifested as excessive watering known as "defluxion". For medical treatment, she was sent to France, where she lived with her paternal grandmother, Henrietta Maria of France, at the Château de Colombes near Paris. Following her grandmother's death in 1669, Anne lived with an aunt, Henrietta Anne, Duchess of Orléans. On the sudden death of her aunt in 1670, Anne returned to England. Her mother died the following year.