Where do horseshoe crabs live water or land?

they live in water but do wander onto land for food or mateing.