The town lies south of Castle Douglas and Dalbeattie, in the part of Dumfries and Galloway known as the Stewartry, situated at the mouth of the River Dee, some six miles from the sea. It was the county town of the former county of Kirkcudbrightshire.
Spottiswood, in his account of religious houses in Scotland, mentions that the Franciscans or Grey Friars had been established at Kirkcudbright from the 12th century. No traces of the Greyfriars or Franciscan dwellings remain in the parish of Kirkcudbright.
In 1453, Kirkcudbright became a Royal burgh , and about a century later the magistrates of the town obtained permission from Queen Mary to use part of the convent and nunnery as a parish church. From around 1570, Sir Thomas Maclellan of Bombie, the chief magistrate, received a charter for the site, its grounds, and gardens. Maclellan dismantled the church in order to obtain material for his proposed castle and proceeded to have a very fine house, MacLellan's Castle, built on the site.
After defeat at the Battle of Towton, Henry VI of England crossed the Solway in August 1461 to land at Kirkcudbright in support of Queen Margaret at Linlithgow. The town also successfully withstood a siege in 1547 from the English commander Sir Thomas Carleton, but after the surrounding countryside had been overrun was compelled to surrender.
The Tolbooth was built between 1625 and 1629 and served not only as the tollbooth, but also the council offices, the Burgh and Sheriff courts, the criminal prison, and the debtors' prison. One of its most famous prisoners was John Paul Jones, hero of the American navy, who was born in nearby Kirkbean.
The Kirkcudbright Railway opened in 1864, but the railway line and station closed in 1965.
The Tolbooth building is now used as an Arts Centre.
Kirkcudbright has had a long association with the Glasgow art movement, which started when a colony of artists, including the Glasgow Boys and the famed Scottish Colourists, such as Samuel Peploe and F. C. B. Cadell, based themselves in the area over a 30-year period from 1880 to 1910.
Many of them moved to the town from Glasgow, including E A Hornel, George Henry, and Jessie M King, and their presence led to Kirkcudbright becoming known as "the artists’ town", although this moniker may have originated more from tourist board publicity rather than local usage.
The whodunit Five Red Herrings by Dorothy L. Sayers involves the artistic community of Kirkcudbright. In 1975, the book was made into a film shot in the town, with Ian Carmichael playing the lead role of Lord Peter Wimsey.
The town also featured in the cult 1973 horror film The Wicker Man. Several parts of the town can be easily recognised in the film.