Charles II's father, Charles I, was executed at Whitehall on 30 January 1649, at the climax of the English Civil War. Although the Parliament of Scotland proclaimed Charles II king on 5 February 1649, England entered the period known as the English Interregnum or the English Commonwealth, and the country was a de facto republic, led by Oliver Cromwell. Cromwell defeated Charles II at the Battle of Worcester on 3 September 1651, and Charles fled to mainland Europe. Cromwell became virtual dictator of England, Scotland and Ireland. Charles spent the next nine years in exile in France, the Dutch Republic and the Spanish Netherlands. A political crisis that followed the death of Cromwell in 1658 resulted in the restoration of the monarchy, and Charles was invited to return to Britain. On 29 May 1660, his 30th birthday, he was received in London to public acclaim. After 1660, all legal documents were dated as if he had succeeded his father as king in 1649.
Charles's English parliament enacted laws known as the Clarendon Code, designed to shore up the position of the re-established Church of England. Charles acquiesced to the Clarendon Code even though he favoured a policy of religious tolerance. The major foreign policy issue of his early reign was the Second Anglo-Dutch War. In 1670, he entered into the Treaty of Dover, an alliance with his first cousin King Louis XIV of France. Louis agreed to aid him in the Third Anglo-Dutch War and pay him a pension, and Charles secretly promised to convert to Catholicism at an unspecified future date. Charles attempted to introduce religious freedom for Catholics and Protestant dissenters with his 1672 Royal Declaration of Indulgence, but the English Parliament forced him to withdraw it. In 1679, Titus Oates's revelations of a supposed "Popish Plot" sparked the Exclusion Crisis when it was revealed that Charles's brother and heir (James, Duke of York) was a Catholic. The crisis saw the birth of the pro-exclusion Whig and anti-exclusion Tory parties. Charles sided with the Tories, and, following the discovery of the Rye House Plot to murder Charles and James in 1683, some Whig leaders were executed or forced into exile. Charles dissolved the English Parliament in 1681, and ruled alone until his death on 6 February 1685. He was received into the Catholic Church on his deathbed.
Charles was one of the most popular and beloved kings of England, known as the Merry Monarch, in reference to both the liveliness and hedonism of his court and the general relief at the return to normality after over a decade of rule by Cromwell and the Puritans. Charles's wife, Catherine of Braganza, bore no live children, but Charles acknowledged at least twelve illegitimate children by various mistresses. He was succeeded by his brother James.
Charles II was born at St James's Palace on 29 May 1630. His parents were Charles I (who ruled the three kingdoms of England, Scotland and Ireland) and Henrietta Maria (the sister of the French king Louis XIII). Charles was their second child. Their first son was born about a year before Charles, but died within a day. England, Scotland, and Ireland were respectively predominantly Anglican, Presbyterian, and Catholic. Charles was baptised in the Chapel Royal, on 27 June, by the Anglican Bishop of London, William Laud. He was brought up in the care of the Protestant Countess of Dorset, though his godparents included his maternal uncle Louis XIII and his maternal grandmother, Marie de' Medici, the Dowager Queen of France, both of whom were Catholics. At birth, Charles automatically became Duke of Cornwall and Duke of Rothesay, along with several other associated titles. At or around his eighth birthday, he was designated Prince of Wales, though he was never formally invested.
During the 1640s, when Charles was still young, his father fought Parliamentary and Puritan forces in the English Civil War. Charles accompanied his father during the Battle of Edgehill and, at the age of fourteen, participated in the campaigns of 1645, when he was made titular commander of the English forces in the West Country. By spring 1646, his father was losing the war, and Charles left England due to fears for his safety. Setting off from Falmouth after staying at Pendennis Castle, he went first to the Isles of Scilly, then to Jersey, and finally to France, where his mother was already living in exile and his first cousin, eight-year-old Louis XIV, was king. Charles I surrendered into captivity in May 1646.