England players Marcus Rashford, Jadon Sancho and Bukayo Saka were victims of a stream of abuse on Instagram and Twitter -- many apparently from foreign trolls and bots.
While some people identifying as England fans used racial slurs in blaming the trio for the defeat, other offensive messages were accompanied with "forza italia" hashtags.
Johnson said the team had "made history" and "brought joy to this country".
"To those who have been directing racist abuse at some of the players, I say shame on you and I hope you will crawl back under the rock from which you emerged," he told a news conference.
England's players have made a strong stand against racism at the tournament, taking a knee before their games including the final.
But Johnson and others in the Conservatives' "anti-woke" government had initially dismissed that as "gesture politics" and defended the freedom of speech of England fans who booed the players, before backing the team later in the tournament.
Asked if he would now take the knee himself, Johnson said: "People should feel free to show their respect and show how much they condemn racism in this country in any way that they choose."
Former Manchester United player Gary Neville accused the prime minister of having "promoted" racism, noting one notorious past comment by Johnson likening Muslim women who wear the veil to "letter-boxes".
Former Conservative party chairwoman Sayeeda Warsi urged the government: "It's time to stop the culture wars that are feeding division.
"Dog whistles win votes but destroy nations."
Prince William 'sickened'
Downing Street noted that new UK legislation coming up will mandate tougher action by social media companies.
Facebook said it had "quickly removed comments and accounts directing abuse" at the footballers.
"No one thing will fix this challenge overnight, but we're committed to keeping our community safe from abuse," it added.
Twitter also claimed it had "removed over 1000 Tweets and permanently suspended" a number of accounts that violated its rules.
"The abhorrent racist abuse directed at England players last night has absolutely no place on Twitter," said a spokesman for the company.
London's police force said it was aware of "a number of offensive and racist social media comments", promising an investigation.
The Metropolitan Police also said it was probing scenes of mayhem after some ticketless fans forced their way into Wembley Stadium.
Greater Manchester Police in northwest England said they were treating as a racist incident the defacement of a mural in the city in honour of Rashford.
Obscenities and Saka's name were daubed over the artwork.
England player Raheem Sterling also received a stream of racial abuse after social media users accused him of cheating to win a penalty in England's semi-final win over Denmark.
European football's governing body UEFA said it "strongly condemns the disgusting racist abuse" and that "we stand by the players and the English FA's call for the strongest possible punishments".
The Football Association said: "We're disgusted that some of our squad -- who have given everything for the shirt this summer -- have been subjected to discriminatory abuse online after tonight's game.
"We stand with our players."
Prince William, the FA's president who attended the final with his wife Kate and son George, said he was "sickened" by the abuse.
But the overwhelming majority of messages were in support of the players, who have been praised throughout the tournament for helping bring together a nation hard hit by the coronavirus pandemic.