The municipality was formed on 8 September 1857, through the merger of the former municipalities of Haarlemmerliede and Spaarnwoude [REF].
During the construction of the North Sea Canal (completed 1867), large portions of the IJ Bay were enclosed with dikes and made into polders, thereby enlarging the area of the municipality significantly.