Brenton Tarrant, a 29-year-old Australian, pleaded guilty earlier this year to 51 charges of murder, 40 counts of attempted murder and one charge of committing a terrorist act during the March 2019 rampage in the southern city, which he livestreamed on Facebook.
In delivering the sentence, High Court Judge Cameron Mander said on Thursday that a finite term was insufficient for such a crime and that Tarrant had shown no remorse.
"Your crimes are so wicked that even if you are detained until you die it will not exhaust the requirements of punishment and denunciation," Mander said.
"As far as I can discern, you are empty of any empathy for your victims."
Prosecutors told the court at the opening of the sentencing hearing on Monday that Tarrant had been planning the attacks for a long time and wanted to create fear among immigrants.
The killer had been representing himself and said through a lawyer in court on Thursday that he did not oppose the sentence. Dressed in grey prison clothes and surrounded by guards, Tarrant did not react to the sentence.
"The hatred that lies at the heart of your hostility to particular members of the community that you came to this country to murder has no place here - it has no place anywhere," Mander said.
The March 2019 attacks shocked New Zealand and prompted new laws banning the deadliest types of semi-automatic weapons. They also prompted global changes to social media protocols.
During the four-day sentencing hearing, 90 survivors and family members recounted the horror of the attacks and the trauma they continue to feel.
Some spoke to the gunman angrily, calling him a monster and a coward. Some recited verses from the Quran or addressed him in Arabic. A few spoke softly to Tarrant, saying they forgave him.
Sara Qasem spoke on Thursday about her beloved father Abdelfattah, who was killed in the attacks.
"All a daughter ever wants is her dad. I want to go on more road trips with him. I want to smell his garden-sourced cooking. His cologne," she said. "I want to hear him tell me more about the olive trees in Palestine. I want to hear his voice. My dad's voice. My Baba's voice."