Elgin is a city in Cook and Kane counties in the northern part of the U.S. state of Illinois. Located roughly 35 mi northwest of Chicago, it lies along the Fox River. As of 2013, the city had a total population of 110,145, making it the eighth-largest city in Illinois.