In the late 18th century, an anti-slavery movement began to get a lot of backing in Britain, firstly by some religious groups, such as the Quakers.
People began to stop using sugar as they didn't want to be seen to be supporting the use of slaves on the big sugar plantations.
Thomas Clarkson spent seven years riding 35,000 miles on horseback across Britain, getting support for the anti-slavery campaign and in 1787 persuaded the MP William Wilberforce to take the fight into Parliament.
At the same time, slaves were protesting about how they were being abused. One of these was Olaudah Equiano, a former slave who bought his own freedom and published a best-selling book.
The Abolition of the Slave Trade Act was passed by the British Parliament on 25 March 1807.
This law included a fine of £100 for every slave found aboard a British ship - at that time the fine was so high it probably would have put the ship owner out of business.
Anti-slavery meeting in Exeter Hall, Exeter, in 1841
Slavery was then wiped out slowly - with slaves first being freed but signed up to work in "an apprenticeship" for their masters for five years.
By 1838 all slaves in the British Empire were formally set free.
Slaves didn't get any money for all the work they had done, but slave owners were given money for the loss of the slaves! One example was the Bishop of Exeter who gave up 665 slaves so got £12,700 (around £750,000 today).