Ashby is a town located in Middlesex County, Massachusetts. It was first settled in 1676 and was officially incorporated in 1767.
According to the United States Census Bureau, the town has a total area of 62.6 km² (24.2 mi²). 61.6 km² (23.8 mi²) of it is land and 1.0 km² (0.4 mi²) of it is water. The total area is 1.53% water.