Monterey is a city located in Monterey County on the southern edge of Monterey Bay on the U.S. state of California's Central Coast. Founded on June 3, 1770, it functioned as the capital of Alta California under both Spain (1804–1821) and Mexico (1822–1846). During this period, Monterey hosted California's first theater, public building, public library, publicly funded school, printing-press, and newspaper. It was originally the only port of entry for all taxable goods in California. In 1846, during the Mexican–American War of 1846–1848, the United States Flag was raised over the Customs House. After Mexico ceded California to the U.S. at the end of the war, Monterey hosted California's first constitutional convention in 1849. The city occupies a land area of 8.466 sqmi and the city hall is at 26 ft above sea level. The 2020 census recorded a population of 30,218.