Southern states began seceding soon after Abraham Lincoln was elected president, but before he was inaugurated. South Carolina led the charge by seceding on December 20, 1860. Six other Southern states soon followed suit in January and February. Kansas was admitted as a free state in January of that year, and it was destined to become a Union state.
On June 8, 1861, almost two months after the first shots of the Civil War were fired at Fort Sumter, Tennessee became the 11th and final state to secede from the union, joining Alabama, Arkansas, Florida, Georgia, Louisiana, Mississippi, North Carolina, South Carolina, Texas, and Virginia.
The Union then consisted of the remaining 23 states: California, Connecticut, Delaware, Illinois, Indiana, Iowa, Kansas, Kentucky, Maine, Maryland, Massachusetts, Michigan, Minnesota, Missouri, New Hampshire, New Jersey, New York, Ohio, Oregon, Pennsylvania, Rhode Island, Vermont, and Wisconsin.
In Kentucky and Missouri, both of which allowed slavery, rival Confederate governments were set up in late 1861, and they declared their allegiance to the Confederacy. Although the Confederacy claimed these states for themselves, Union state governments maintained continuous control of the government and its resources, and those rival Confederate governments soon found themselves in exile.
Both the Union and the Confederacy grew during the four years of the Civil War. In 1863, a northwestern region of Virginia seceded from the Confederacy and was admitted into the Union as the state of West Virginia. Nevada became a state and joined the Union in 1864, bringing the total number of Union states to 25. The South also claimed as its own some southern areas of the Arizona territory (which included parts of what are now Arizona and New Mexico).
By the end of the war, the Union comprised 25 states, and the Confederacy had only 11.