Gloucester is a city in Essex County, Massachusetts, United States. It sits on Cape Ann and is a part of Massachusetts's North Shore. The population was 29,729 at the 2020 U.S. Census.