Thank you for the answer. As a further question, what would be the latest date that the civil war could be avoided and slavery ended before 1900?
June 21, 1788. The day the Constitution was ratified without a definitive sunset date on slavery some sort of major break was more or less inevitable.
A more elegant date would be December 8, 1765, Eli Whitney's birthday. Without his cotton gin that allowed cotton to be extracted at an economically viable cost the need for, and value of, slaves would have been depressed to the point that abolition might be possible without the economic devastation feared by the Planter class IOTL (Slaves were, horrifically, by far the most valuable commodity in pre-ACW America). If the cost of maintaining a large number of slaves exceeded the RoI they represented the need for, and attraction of, holding large numbers of persons in bondage would evaporate. Crops other than cotton simply didn't have the cost/benefit ratio necessary to justify what, by 1860, amounted to 1/3 of the U.S. population.
If you look at the statistics of slave ownership, even in 1860, you find that of the ~393K slave holders, 78K owned one slave, 47K owned two, and the total number slave owner that held 1-5 slaves was ~216K with a total of under half a million slaves. That number slaves could, over a 20 year period, have been freed with their owners compensated by the government, ending slavery by compensation and legislation that made any person born in the U.S., regardless of parents circumstances, free born. This would have been costly, but compared to the cost, just in gold, of the ACW it would have been a bargain.
The problem was the fact that a limited number of large plantation owners held most of the additional 3.5 MILLION slaves, something that raised the overall value of the slave population to well of the U.S. government annual budget, and made any sort of compensated emancipation impossible.