Just over four years - February 1861 to roughly mid-June 1865.
Slavery wasn’t outlawed (by Presidential decree) until January 1, 1863. Thus, 2 years, 4 months.