Battery cages for hens are to be phased out and will be banned from 2022, the government has announced.
Primary Industries Minister David Carter says that from Friday no new battery cages can be installed by egg producers.
"Scientific evidence and strong public opinion have made it clear that change is necessary," he said on Thursday.
A new code of conduct will allow hens to be kept in colony cages - a larger cage - or in barns.
Mr Carter says more than 80 per cent of New Zealand eggs are laid in battery cages, so the change will be "a major shift" for producers.
Under the new code, about 45 per cent of battery cages will be gone by 2018.
"An immediate prohibition of battery cages would have an unacceptable impact on egg prices, industry structure and the stability of egg supply," Mr Carter said.