Chancellor Angela Merkel's cabinet approved the tough measure after assessing that companies like Twitter and Facebook were not doing enough to erase content that ran afoul of German law.
"Hate crimes that are not effectively combatted and prosecuted pose a great danger to the peaceful cohesion of a free, open and democratic society," said Merkel's government in a statement.
Since the arrival of around one million asylum seekers in Germany since 2015, the volume of xenophobic hate speech has exploded online.
Alarmed by the incendiary nature of the posts, the government has repeatedly warned the online behemoths to take action to better police the content on their network.
The web companies had pledged in 2015 to examine and remove within 24 hours any hateful comments, but in a recent report tracking progress on this front, Justice Minister Heiko Maas said not enough was done.
Maas said Twitter only took down one percent and Facebook 39 percent of the content reported by users deemed to flout Germany's anti-hate speech laws.
Google's YouTube video sharing platform fared far better, with a rate of 90 percent according to a government study cited by the minister.
Beyond hate speech and fake news, the draft legislation also covers other illegal content, including child pornography and terror-related activity.
The companies would have 24 hours to remove any posts that openly violate German law after they are flagged by users.
Other offensive content would have to be deleted within seven days after it is reported and reviewed.
Executives of the social media groups also risk individual fines up to five million euros ($5.3 million) in case of non-compliance.
Under German law, Holocaust denial, incitement of hatred and racist speech are illegal.
But critics warned that the proposed law could stifle freedom of expression.
Facebook said it was examining the proposed rule, but stressed that it has heavily invested in boosting the resources of its content review team.
More than 700 people will be working on the task force for the company in Berlin by year's end, said the group, which posted a net profit of $3.7 billion (3.5 billion euros) in the last three months of 2016.
It also rejected the data cited by Maas, saying that a test carried out by FSM - a self-regulation lobby group backed by online media - found that Facebook deleted more than 65 percent of illegal content within a day.
Maas acknowledged that freedom of expression "has huge significance in our democracy".
But he added: "Freedom of expression ends where criminal law begins," predicting that Germany's measure would only be a beginning.
"In the end, we need European solutions for companies that operate across Europe," Maas told reporters.
Talking To A Wall
Underlining the frustration with the slow-moving fight against such online hate, one social network user, Steffi Brachtel, told AFP she had filed countless complaints to Facebook over offensive posts.
But only once did it agree to remove a post - a Hitler-related one, she said.
The waitress had begun her one-woman campaign against online hate speech after a friend shared an objectionable cartoon on Facebook.
"I spent several hours every day on Facebook, trying to tell people to watch what they are saying... but got the feeling that I was talking to a wall," she said.
Brachtel said she also faced physical threats. Neo-Nazis followed her on her way home and her letterbox was bombed.
But she warned that if action is not taken against far-right material, "then it just gets passed on and on, and that's how the hate gets bigger in people, and that's a major problem."