The online code of conduct, called "Stop, Speak, Support," is the first in the world of its kind. Its aim is to create a safer space online for children and give them online resources if they feel threatened or lost.
William, 35, brought together the world’s leading tech firms -- including Google, YouTube, Twitter, Facebook and Snapchat -- as part of The Royal Foundation's task force on the prevention of cyberbullying. The task force, which first convened in May 2016, also included parents, children and representatives from children's charities.
The tech firms that are part of the task force have also agreed to make changes, William announced in his speech today.
"The technology company members of the Taskforce have agreed to adopt new guidelines to improve the process for reporting bullying online, and to create clearer consequences for those who behave unacceptably," he said.
The online code of conduct includes a website where kids can go for support. The website teaches children to stop participating when they see negative comments, speak out to adults and/or report the bullying to the social media platform and to support the person being bullied.
Kensington Palace on Wednesday released a moving video of William speaking with a mother who lost her son to suicide and a teen girl who attempted suicide after being the victim of cyberbullying.
"I started to self-harm as a way to cope, to make me feel better, and then I decided that I couldn't take this anymore and I tried to end my life," Chloe, who was cyberbullied at the age of 13, told William during their conversation at Kensington Palace.
In the video, William praised the women for their bravery and told them, "I only wish that neither of you had gone through what you've gone through."
"I think it is worth reminding everyone what the human tragedy of what we are talking about here," William said. "It isn't just about companies and about online stuff. It's actually real lives that get affected."
William also became interested in this cause through his work as an air ambulance pilot, where he witnessed and responded to many young men in despair and on the verge of suicide. After hearing a story of a little boy who killed himself due to online abuse, William vowed to get involved himself.
"Through my work on mental health, I have spent time getting to know parents and children for whom the impact of online bullying has been devastating," William said. "And as a parent myself, I understand the sense of loss and anger of those particular families who have lost children after they were the targets of campaigns of harassment."