Social media is supposed to be the great enabler of free speech, but in fact it's full of paradoxes. Posting on Twitter or Facebook is sometimes the quickest way to get censored. Governments like China and Vietnam closely monitor the online space for any sign of dissent, and a recent law passed in Saudi Arabia means a simple retweet could land you in prison for a decade.

Life is better in the UK, but the contradictions persist. Caroline Criado-Perez received misogynistic threats when she launched a campaign to keep a woman on the £10 note. Jane Goldman felt compelled to leave Twitter after receiving a torrent of abuse – ironically because her husband Jonathan Ross was perceived as sexist. Rape threats, hate speech and racism are common on social media. Women and minority voices are being forced off the platform: precisely the people who we need to hear more from in our political and cultural discussions.

These contradictions are a challenge to anyone who values free expression and open rights online. If we do not act to fix this problem – with either social or technological solutions – then those in parliament who are less concerned with protecting human rights will simply introduce tougher legislation to fix the problem for us.

Are we seeing the beginnings of this process already? Tomorrow, a parliamentary committee will debate an amendment to the criminal justice and courts bill that will allow tougher sentences for those who send threatening messages. But in acting to protect individuals, parliament may unwittingly be squeezing free expression.

Conveniently, Crown Prosecution Service guidelines published last year set out the laws that allow people to be prosecuted for what they write on Twitter. They were all enacted before social media existed, and are written with telephones and fax machines in mind. Updates are clearly required. However, the guidance produced by the then director of public prosecutions, Keir Starmer QC also carried a robust defence of free expression and the right to offend. Starmer said that to protect free speech it would not usually be in the public interest to prosecute tweets under the Malicious Communications Act 1988 or the Communications Act 2003 (which carries the highly subject term "grossly offensive" as a trigger for prosecution). By contrast, Starmer said that offences under the Protection from Harassment Act 1997 should be prosecuted "robustly". This is a sensible distinction. Clear and present threats and systematic harassment should be prosecuted, but offensive or even racist speech should not be criminalised. Had these guidelines been in place earlier, it is unlikely that the convictions of Liam Stacey and Matthew Woods (who made tasteless remarks about Fabrice Muamba and April Jones respectively) would have come to court, but those who threatened Stella Creasy MP and Caroline Criado-Perez would have found no extra protections.

Tomorrow's amendment, which Chris Grayling has said the government will support, changes the Malicious Communications Act 1988 to provide tougher sentences. Politicians debating the measure should be mindful of Starmer's warning that such prosecutions would rarely be in the public interest.

Moreover, by simply tinkering with sentencing limits, parliament is missing a trick. If politicians really want to make the laws dealing with social media fit for purpose, they must also remove the problematic language of "offence" from the Communications Act. This could be achieved with a single-line amendment deleting the words "grossly offensive or" in section 127 (1). The government has agreed to this sort of thing before.

Giving offence is a necessary tool in a democracy. It is an essential component in speaking truth to established interests. Following this principle does mean that poor taste jokes and unpalatable political opinions remain uncensored in the public domain. But it is preferable for offensive speech to remain part of the conversation, than for it to be criminalised and driven underground, where it cannot be challenged. And our noisy, diverse and often offensive culture is far better for progress than the stunted, straitjacket politics experienced by the people of China, Vietnam and Saudi Arabia.