Apple and Google have been given a three-month ultimatum to make it impossible for children to take, share or view nude images on their smartphones, Prime Minister Sir Keir Starmer said.
The Government wants firms to activate built-in features on their devices or come up with technological solutions on phones and tablets to detect and block such content.
It means all adults will need to verify their age if they want to take or view nude images.
Firms must implement changes or face new legislation, which could lead to fines, and as a last resort, criminal liability for tech bosses.
The changes will apply to both existing and newly sold smartphones and tablets in the UK.
In a speech at London Tech Week, the Prime Minister said: “One issue is the ability for children with phones to send and receive nude images.
“For too long, people have been told that is simply the price of modern tech, that nothing can be done, that Government is powerless, that parents just have to accept it.
“I reject that completely, because tech should adapt to the needs of society, not the other way around.”
He added: “That is why today I am calling on tech companies operating in this country to introduce device controls that prevent children from sending and receiving sexually explicit images.
“Because this is not an impossible challenge. These are some of the most innovative companies in the world and I believe they can solve it.
“But if they choose not to, then we will act and we will change the law because when it comes to the safety of our children, standing by is not an option.”
Home Office officials said they are already working on draft legislation, but would not say how long it might take to become law.
Home Secretary Shabana Mahmood said: “As a society, we have not kept pace with the changing threats that children face. Abuse online is far too common, and we will not tolerate it.
“Tech companies have a moral duty to act, by making it impossible for children to take, share or view nude images. If they don’t, we will legislate.”
Virtually all smartphones sold in the UK either run on Apple or Google operating systems.
Officials said Apple was already taking action with age checks for iPhone users, making it the first company to activate safety features by default for under-18s.
But nudity detection is not applied to the camera, third-party messaging apps or search functions, meaning children can still take, view, share and save naked pictures.
A Google spokesperson said: “Google is deeply committed to protecting children online.
“We are working constructively with UK partners to find effective, privacy-preserving solutions that deter the spread of harmful content while ensuring a safe digital environment for young people.”
The changes will not apply to laptops or desktops at this stage.
Labour MP Jess Phillips resigned as safeguarding minister at the Home Office earlier this year, accusing Sir Keir of being slow to threaten legislation on preventing children taking naked images of themselves, despite the technology being available.
In response to Monday’s announcement, she said: “My reaction is one of relief that this has happened.
“I look forward to working with the Government on what the legislation needs to be to make sure that no child can ever be tricked in to taking naked images of themselves for the use of global paedophile networks.”
Children’s charity the NSPCC welcomed the Government’s announcement, insisting “time is up for big tech”.
The National Crime Agency welcomed Sir Keir’s announcement, and said device restrictions have the potential to prevent some of the most serious forms of online child sexual abuse before they begin.
Sir Keir is expected to go further in the coming days with widespread expectation that he will announce a ban on children under-16 being able to access harmful social media sites.
Multiple reports have suggested he will take the step before the Makerfield by-election on June 18 which could see potential leadership challenger Andy Burnham return to Parliament.
Meanwhile, a separate consultation will lead to guidance for parents on when a child should get their first smartphone and how long under-16s should spend in front of screens.
The call for evidence will also seek views on screen use in schools, where ministers believe technology can play a vital role, particularly for children with special educational needs and disabilities (Send).
Kemi Badenoch said the Prime Minister needs to get children off social media rather than taking “piecemeal” action.
“I think the move today is an idea without a proper plan behind it.
“I don’t want to see children being able to send nudes, but I don’t know exactly how the Government is looking at this.
“A much simpler way of dealing with these things is getting children off social media rather than piecemeal measures that are tackling the problems issue by issue,” she told the Press Association.
Liberal Democrat deputy leader Daisy Cooper meanwhile said it is “desperately sad” the Prime Minister has only now issued the ultimatum.
Ms Cooper told the Press Association: “I just find it desperately sad that it has taken almost two years for the Prime Minister to do this, and I think it’s desperately sad that he’s now doing it in the context of a leadership challenge rather than doing it because it’s the right thing to do.
“I think all of us were moved when we heard Jess Phillips talking about her pleading with the Prime Minister.”