The attorney general is to publish guidance on Twitter to help prevent social media users from committing contempt of court when commenting on legal cases.
Dominic Grieve QC said it was designed to make sure fair trials took place.
Peaches Geldof recently apologised for tweets relating to a case, and several people were fined last year for naming a woman raped by footballer Ched Evans.
The advice will apply to court cases in England and Wales.
The rise of social media has meant that conversations about criminal cases, once had down the pub or over the garden fence, are now instantly published online – and can be shared with thousands, BBC legal correspondent Clive Coleman says.
But Facebook and Twitter are publications subject to the same laws that in practice used to apply only to the mainstream media.
Anyone commenting about a case or defendant in a way that could prejudice a trial could be prosecuted for contempt and imprisoned.
That is why the attorney general is going to start publishing advice – that previously only went to the media – to the public via his website and Twitter feed.
It is designed to help inform people about the legal pitfalls of commenting in a way that could be seen as prejudicial to a court case or those involved.
Mr Grieve said blogs and social media sites allow individuals to reach thousands of people with a single post, which he said was an “exciting prospect” but one which “can pose certain challenges to the criminal justice system”.
He said he was not proposing “some sort of big brother watch” but wanted to educate people, possibly starting in schools.
Guidelines currently issued to the media about high-profile cases could be published online and through Twitter to prevent legal risks and the collapse of trials, he said.
Mr Grieve said tweets by a juror had caused one sexual offences case to collapse, costing £300,000 and “requiring all the witnesses to go through the process all over again”.
And he said misuse of social media could undermine the fairness of trials, which could call into question “the whole future of jury trials, which most people regard as a very important safeguard for our freedoms”.
He said the “simplest rule” people should follow is not to comment on live trials online.
Technology expert Tom Cheesewright said social media offered “instant publishing”.
He said some individuals have more Twitter followers than national newspapers have subscribers but – unlike journalists – they do not have legal training or “an editor to stop them”.
People may write posts while drunk or in “emotional states”, he added.