Internet trolls who create derogatory hashtags or doctored images to humiliate others could face prosecution in England and Wales.
Inciting people to harass others online, known as virtual mobbing, could also result in court action, under new Crown Prosecution Service guidance.
The director of public prosecutions said it means the CPS would prosecute just as if offences occurred offline.
But she stressed this did not mean prosecutors could "stifle free speech".
The new guidance aims to help police identify online crimes more easily.
It also highlights those who post people's personal information, such as bank details - known as doxxing.
Speaking to BBC Radio 4's Today programme, Director of Public Prosecutions Alison Saunders said: "The internet's not an anonymous place where people can post without any consequences. People should think about their own conduct.
"If you are grossly abusive to people, if you are bullying or harassing people online, then we will prosecute in the same way as if you did it offline."
However, Ms Saunders said context will be an important factor in decisions - for example "if you're offensive, the legislation would say you have to be grossly offensive, and that's quite a high test".
One woman, who wished to remain anonymous, said she and her daughter, who has Down's Syndrome, had suffered such severe online abuse over the last six years that they had to move house three times.
The abuse started, she said, when a friend wrote a book about trolls - anonymously but mentioning her by name.
"The trolls photoshopped images of myself and my daughter on to pornography and posted it on Facebook. They have said I'm a paedophile and called her hateful names like mongoloid; they even set up a website in her name."
The woman believes the trolls kept getting hold of her details using official forms she submitted when complaining at the use of images of her daughter.
"Even after we moved, they have called us at three of four in the morning threatening to petrol-bomb our house if we will not give up the name of the author.
"It's been horrific - this trolling is not free speech; it's hate speech," she said.
'No escape from it'
She added that one of the men stood outside the family home and followed her daughter to school, taking pictures.
The incidents are now being investigated by police.
Kevin Healey told the BBC's Victoria Derbyshire programme he had been abused online for five years over his autism campaign work.
He said: "Not even one troll has been prosecuted or jailed, even though I have made complaints to Twitter and the police.
"It's been a nightmare; it's been horrific - it doesn't go away. It's with you 24 hours and seven days a week, there's no escape from it".
Mr Healey said he doesn't think the changes will make any difference and wants changes to legislation in the UK - and abroad.
"With the laws in the UK, if someone is trolling you from outside the UK - and my last batch of trolls were from the US - the police said we can't do anything," he added.
The CPS says it will use "considerable caution" before charging those posting "grossly offensive" material.
The changes come after a report found that one in four teenagers is abused online over their sexual orientation, race, religion, gender or disability.
The CPS also said underage "sexting" between consenting children in a relationship should not be prosecuted, but cases which involve "exploitation, grooming or bullying" may lead to legal action.
Ms Saunders told the BBC: "If they are children, they are the same age, there's no suggestion or any coercion or bad motives, then we would not expect that case to be prosecuted. It shows you how careful you have to be about the context of it," she said.
Asked about whether guidelines on misogynistic hate crimes would be introduced, Ms Saunders said: "We probably need to think about it."
A new law on revenge porn - someone uploading explicit images or film of a former partner to humiliate or embarrass them - has led to the prosecution of 206 people across England and Wales since its introduction in April 2015.
The public policy statements on hate crime will be subject to public consultation for 13 weeks.