Its most infamous moment is enshrined on a simple stone lying in the ground outside its door – which marks the spot where the last man to be hanged in the town was executed.
It was only 1965 when the Murder Act abolished the death penalty for murder in Scotland, and by then executions had become rare.
But 200 years ago hundreds faced the noose across the country for crimes ranging from hamesucken (attacking someone in their own home) to “throwing vitriol” (attacking someone with acid).
Among them was Dalkeith highwayman William Thomson.
He is included on a website which has brought together all the executions which took place across the United Kingdom as we approach the 60th anniversary of the last hanging in 1964.
Thomson, a labourer, was one of three men found guilty of attacking and robbing farmer George Dickson as he returned home from Dalkeith market.
Mr Dickson was riding home to Cousland on horseback when the men confronted him.
They left him seriously injured after bludgeoning him with wooden weapons before robbing him of a silver watch, a copy of the Scotsman and a letter addressed to his wife. Among other items.
Thomson, who struck the first blow, was sentenced to death for highway robbery, while his co-offenders, one of whom was heard shout “murder him” as the bloody assault took place, were shown mercy .
The attack happened on November 30, 1826 and Thomson faced the noose in Dalkeith on March 1 , 1827.
Thomson, whose age at the time of his death was not known was said by the jail chaplain to have been initially bitter after seeing his fellow offenders – one of whom was his brother James – escape execution.
But they reported he “latterly became very penitent and regretted exceedingly the life he formerly led”.
A broadside report of his final days revealed “on Wednesday he took a last farewell of his wife, and several other friends, which was a most heart-rending scene, we have heard, to those who witnessed it.”
The execution of Thomson was unusual in that he was brought to Dalkeith from Calton Jail in Edinburgh. It drew a large crowd as no-one could remember a hanging in the town itself.
The report of the execution said: “While the executioner was untying his handkerchief, fixing the rope, and drawing the cap over his head, he (Thomson) was observed to be engaged in most fervent prayer.
“All things being adjusted, and the unfortunate man left on the fatal drop, with instructions how to act, in a very few minutes he dropped the signal, and was launched into eternity, amidst a vast multitude of spectators, there being no execution in Dalkeith, within the memory of any living man.
“After hanging for half an hour, the body was cut down, and delivered to his friends for interment.”
At the time the Tolbooth was a place of law and order, with a court and prison within it.
Nowadays it has a more modern use as the base or MYPAS – MIdlothian’s Young People Advice Service.