Hannibal is a city along the Mississippi River in Marion and Ralls counties in the U.S. state of Missouri. According to the 2020 U.S. Census, the population was 17,312, making it the largest city in Marion County. The bulk of the city is in Marion County, with a tiny sliver in the south extending into Ralls County.