Nanjing was the capital of China during several historical periods , including the former capital city of Republic of China , and is listed as one of the Four Great Ancient Capitals of China . It served as the capital of China during several historical periods and is recognized as one of the Four Great Ancient Capitals of China . Nanjing was the capital of the Republic of China before the Chinese Civil War in 1949 .