James IV (17 March 1473 – 9 September 1513) was the King of Scotland from 11 June 1488 to his death.
He assumed the throne following the death of his father, King James III, (1451/52–1488, reigned 1460–1488) at the Battle of Sauchieburn, a rebellion in which the younger James played an indirect role.
He is generally regarded as the most successful of the Stewart monarchs of Scotland, but his reign ended in a disastrous defeat at the Battle of Flodden.
He was the last monarch from the island of Great Britain to be killed in battle.
James IV's marriage in 1503 to Margaret Tudor linked the royal houses of Scotland and England.
It led to the Union of the Crowns in 1603, when Elizabeth I died without heirs and James IV's great-grandson James VI succeeded to the English throne as James I.