The review, to be carried out by the Law Commission, will be designed to ensure that the law is "up to date with technology", a joint statement issued by Downing Street and the Department for Digital, Culture, Media and Sport (DCMS) said.
According to the statement, May wants to "make sure that what is illegal offline is illegal online".
Professor David Ormerod QC, Law Commissioner for criminal law, said: "The digital world throws up new questions and we need to make sure that the law is robust and flexible enough to answer them. If we are to be safe both on and off line, the criminal law must offer appropriate protection in both spaces. By studying the law and identifying any problems we can give government the full picture as it works to make the UK the safest place to be online."
The review was announced as part of a raft of new initiatives outlined by the government on Safer Internet Day on Tuesday.
The government also confirmed plans to introduce a new social media code of practice later this year.
The code will set "minimum expectations on social media companies" in areas such as the way in which content and conduct guidelines should be developed and enforced, protocols for identifying and stopping users who are persistent abusers, reporting mechanisms, and polices and practices around privacy, it said.
The government will also begin to publish data on offensive online content and the action being taken to remove it in a new annual Internet Safety Transparency report, it said.
"The reporting will show: the amount of harmful content reported to companies; the volume and proportion of this material that is taken down; how social media companies are handling and responding to complaints; how each online platform moderates harmful and abusive behaviour and the policies they have in place to tackle it," the government said.
"Annual reporting will help to set baselines against which to benchmark companies’ progress, and encourage the sharing of best practice between companies," it said.
The government also announced that Google, Facebook and Twitter would offer special support to address "abusive content" posted online during election campaigns.
A new online safety guide has also been developed to help schools and other organisations working with children to "prepare young people for digital life", it said.