Charles was the second son of Charles III and his wife, Maria Amalia of Saxony. He was born in Naples (11 November 1748), while his father was King of Naples and Sicily. His elder brother, Don Felipe, was passed over for both thrones, due to his learning disabilities and epilepsy. In Naples and Sicily, Charles was referred to as the Prince of Taranto. He was called El Cazador (meaning "the Hunter"), due to his preference for sport and hunting, rather than dealing with affairs of the state. Charles was considered by many to have been amiable, but simple-minded.
In 1788, Charles III died and Charles IV succeeded to the throne. He intended to maintain the policies of his father, and retained his prime minister, the Count of Floridablanca, in office. Even though he had a profound belief in the sanctity of his office, and kept up the appearance of an absolute, powerful monarch, Charles never took more than a passive part in his own government. The affairs of government were left to his wife, Maria Luisa, and his prime minister, while he occupied himself with hunting. In 1792, political and personal enemies ousted Floridablanca from office, replacing him with Pedro Pablo Abarca de Bolea, Count of Aranda. However, in the wake of the war against Republican France, the liberal-leaning Count of Aranda was himself replaced by Manuel de Godoy, a favourite of the Queen and widely believed to be her lover, who enjoyed the lasting favor of the King.
In 1799, he authorized Prussian aristocrat and scientist Alexander von Humboldt to travel freely in Spanish America, with royal officials encouraged to aid him in his investigation of key areas of Spain's empire. Humboldt's Political Essay on the Kingdom of New Spain was a key publication from his five-year travels.
Godoy continued Aranda's policy of neutrality towards France, but after Spain protested the execution of Louis XVI of France, the deposed king, in 1793, France declared war on Spain. After the declaration, Portugal and Spain signed a treaty of mutual protection against France. In 1796 France forced Godoy to enter into an alliance, and declare war on the Kingdom of Great Britain. As a consequence, Spain became one of the maritime empires to have been allied with Republican France in the French Revolutionary War, and for a considerable duration.
Spain remained an ally of France and supported the Continental Blockade until the British naval victory at Trafalgar, when Spain became allied with Britain. However, after Napoleon's victory over Prussia in 1807, Godoy again steered Spain back onto the French side. This switching of alliances devalued Charles' position as a trustworthy ally, increasing Godoy's unpopularity, and strengthening the fernandistas (supporters of Crown Prince Ferdinand), who favoured an alliance with the United Kingdom.
Economic troubles, rumours about a sexual relationship between the Queen and Godoy, and the King's ineptitude, caused the monarchy to decline in prestige among the population. Anxious to take over from his father, and jealous of the prime minister, Crown Prince Ferdinand attempted to overthrow the King in an aborted coup in 1807.
Riots, and a popular revolt at the winter palace Aranjuez, in 1808 forced the king to abdicate on 19 March, in favor of his son. Ferdinand took the throne as Ferdinand VII, but was mistrusted by Napoleon, who had 100,000 soldiers stationed in Spain by that time.
The ousted King, having appealed to Napoleon for help in regaining his throne, was summoned before Napoleon in Bayonne, along with his son, in April 1808. Napoleon forced both Charles and his son to abdicate, declared the Bourbon dynasty of Spain deposed, and installed his brother, Joseph Bonaparte, as King Joseph I of Spain.
Following Napoleon's deposing of the Bourbon dynasty, the ex-King, his wife, and former Prime Minister Godoy were held captive in France first at the château de Compiègne and three years in Marseille (where a neighborhood was named after him). After the collapse of the regime installed by Napoleon, Ferdinand VII was restored to the throne. The former Charles IV drifted about Europe until 1812, when he finally settled in Rome, in the Palazzo Barberini. His wife died on 2 January 1819, followed shortly by Charles, who died on 20 January of the same year.
Well-meaning and pious, Charles IV floundered in a series of international crises beyond his capacity to handle. He was painted by Francisco Goya in a number of official court portraits, which numerous art critics have seen as satires on the King's stout vacuity.
Charles IV married his first cousin Maria Louisa, the daughter of Philip, Duke of Parma, in 1765. The couple had fourteen children, six of whom survived into adulthood:11 November 1748 – 10 August 1759 His Royal Highness the Prince of Taranto
10 August 1759 – 14 December 1788 His Royal Highness the Prince of Asturias
14 December 1788 – 19 March 1808 His Majesty the King
19 March 1808 – 20 January 1819 His Majesty King Carlos