About 300 have already died at Farewell Spit, on the South Island, in one of the worst such cases in the country.

Hundreds of locals and conservation department staff have been trying to save the survivors since early Friday morning, and have formed a human chain to refloat the whales.

Scientists do not know what exactly causes whales to beach themselves.

But it sometimes happens because the whales are old and sick, injured, or make navigational errors particularly along gentle sloping beaches.

Sometimes when one whale is beached, it will send out a distress signal attracting other members of its pod, who then also get stranded by a receding tide.

The conservation department said it had received a report about a possible stranding on Thursday night, but did not launch the rescue operation until Friday morning as it was too dangerous to attempt a rescue in the dark, reported the New Zealand Herald.

Andrew Lamason, the departments regional manager, said it was one of the largest mass beachings recorded in New Zealand.

New Zealand marine mammal charity Project Jonah. which is leading efforts to save the whales said a total of 416 whales were stranded.

It said the surviving whales are “being kept cool, calm and comfortable” by medics and members of the public.

Some of the refloated whales tried to swim back to shore, and the human chain was trying to herd them out to deeper waters, said volunteer Ana Wiles.

She told news outlet Stuff that there were “so many fins in the air, no breathing”.

“We managed to float quite a few whales off and there were an awful lot of dead ones in the shallows so it was really, really sad.”

“One of the nicest things was we managed to float off a couple [of whales] and they had babies and the babies were following,” Ms Wiles added.

New Zealand has one of the highest stranding rates in the world, with about 300 dolphins and whales ending up on beaches every year, according to Project Jonah..