Barton, 43, is on trial at Liverpool Crown Court accused of 12 counts of sending a grossly offensive electronic communication with intent to cause distress or anxiety.
The charges arise out of a series of posts made in January and March last year on social media site X, formerly Twitter.
Opening the prosecution case on Monday, Peter Wright KC told jurors that Barton had a "sizeable following on X in excess of two million" and his comments on the social media perform "may well be characterised as cutting, caustic, controversial and forthright".
He said: "Some may even consider some of them humorous.
"Everyone is entitled to express views that are all of those things. They are even entitled in a democratic, free society to express views that are offensive, shocking or personally rude when considered against and applying the contemporary standards of an open, just, multi-racial; equal and diverse society.
"What someone is not entitled to do is to post communications electronically that are - applying those standards - beyond the pale of what is tolerable in society.
"We say that the defendant Mr Barton crossed the line between free speech and a crime on 12 occasions.
"On 12 occasions between early January and mid-March last year, he engaged in a quite deliberate course of conduct in which he targeted three people, who are in different ways in the public eye, and he subjected them through his posts to a slew of grossly offensive electronic communications with intent to cause distress or anxiety to the recipient or to any other person to whom he intended its contents or nature to be communicated."
Barton, from Widnes, Cheshire, denies the allegations.