Under the amendment to the country's penal code -- set to take effect later this summer -- offenders convicted of online insults can be jailed for up to one year, or fined 300,000 yen (about $2,200).
It's a significant increase from the existing punishments of detention for fewer than 30 days and a fine of up to 10,000 yen ($75).
The bill proved controversial in the country, with opponents arguing it could impede free speech and criticism of those in power. However, supporters said the tougher legislation was needed to crack down on cyberbullying and online harassment.
It was only passed after a provision was added, ordering the law be re-examined three years after it goes into effect to gauge its impact on freedom of expression.
Under Japan's penal code, insults are defined as publicly demeaning someone's social standing without referring to specific facts about them or a specific action, according to a spokesperson from the Ministry of Justice. The crime is different to defamation, defined as publicly demeaning someone while pointing to specific facts.
Both are punishable under the law.
Seiho Cho, a Japan-based criminal lawyer, warned that the revised law gave no classification of what constitutes an insult.
"There needs to be a guideline that makes a distinction on what qualifies as an insult," Cho said. "For example, at the moment, even if someone calls the leader of Japan an idiot, then maybe under the revised law that could be classed as an insult."
Hana Kimura's death
Kimura, 22, who was known for her role in the Netflix show "Terrace House," died by suicide in 2020. The news triggered grief and shock nationwide, with many pointing to online abuse she had received from social media users in the months leading up to her death.
Other cast members came forward to share their own experiences of online abuse.
Soon after her death, top Japanese officials addressed the danger of cyberbullying and pledged to speed up government discussions on relevant legislation.
Kimura's mother, former professional wrestler Kyoko Kimura, campaigned for stronger anti-cyberbullying laws after her daughter's death, and set up a non-profit organization called "Remember Hana" to raise awareness about cyberbullying.
Kyoko held a news conference after the parliament announced its decision on Monday, praising the new law.
"I want people to know that cyberbullying is a crime," she said, adding she hoped the amendment would lead to more detailed legislation.