Attorney General Dominic Grieve, the government’s chief legal advisor in England and Wales, spoke out following a series of high-profile court cases involving postings made on the micro-blogging site.
“If somebody goes down to the pub with printed sheets of paper and hands it out, that’s no different than if somebody goes and does a tweet,” Grieve told BBC radio.
“The idea that you have immunity because you’re an anonymous tweeter is a big mistake.
“I don’t want to take action but if I think it is necessary to prevent crime, such as racially aggravated harassment, then I won’t hesitate to do it.”
A student who mocked English Premier League footballer Fabrice Muamba on Twitter after he collapsed on the pitch with a heart attack in March was jailed for 56 days after admitting a racially aggravated public order offence.
Some 17 arrests have been made in connection with the alleged naming on Twitter of the woman that Wales footballer Ched Evans was last month convicted of raping.
In March, former New Zealand cricketer Chris Cairns won a libel action against ex-Indian Premier League chairman Lalit Modi in the first libel action heard in England against a post on Twitter.
Judge David Bean dismissed match-fixing allegations levelled against the cricketer, leaving Modi facing a bill of more than £500,000 ($800,000).
Grieve said the government did not need to create new laws as existing ones already make it illegal to “grossly offend” or “cause distress”.