Marshfield is a town in Plymouth County, Massachusetts, United States, on Massachusetts's South Shore. The population was 25,825 at the 2020 census. It includes the census-designated places of Marshfield, Marshfield Hills, Ocean Bluff-Brant Rock, and Cedar Crest, and shares the Green Harbor CDP with the town of Duxbury.