You could answer this one in a number of ways.
First, and most obvious, I would say that the American Civil War ended on April 9, 1865 -- almost 4 years to the day from the day that it started. This was the date on which Robert E. Lee formally surrendered to Ulysses S. Grant.
Second, you could argue that the war actually ended in June of 1865. This is the date that is usually given as the last battle that occurred between Union and Confederate forces. This happened in Texas.
Third, you could argue that the war ended when Reconstruction ended in 1877. This marked the end of the North's attempt to govern the South and make it change its ways.
The civil war should be considered to have ended when the two parties to the conflict agreed to cease armed action against each other. War is not the mere action on the battle ground, it includes the the actions taken to prepare for such action or other armed conflicts. Therefore we can say that the American Civil War ended with the agreement to cease fire by the last Confederate general. This happened on June 23, 1865 when Stand Waite signed a cease-fire agreement with the union representative. The confederate ship CSS Shenandoah had not surrendered by the time. But this was because officers on the ship did not know of the end of the war till August 2, 1865. The ship finally surrendered at Liverpool, England on November 6, 1865.