Social media, messaging platforms and online forums that publish intimate image abuse – often intended to humiliate women and girls – are being instructed to follow new guidelines to stop it spreading.

Ofcom said it will change its codes of practice to force service providers to detect and quash intimate image abuse – sometimes called “revenge porn” – and crack down on AI-generated deepfakes. A wave of deepfakes emerged in January when Elon Musk’s Grok AI was widely used to create sexualised videos of women in bikinis.

Women and girls have long complained of the difficulty of getting distressing images and videos shared without their consent taken down from public sites.

The guidelines come as Ofcom warned such images are increasing in prevalence, with generative AI only making things worse. said there was an “urgent need to reduce the spread of intimate image abuse online”.

The new code follows a threatened legal challenge against the regulator by the campaign group End Violence Against Women and Girls, whose lawyers complained Ofcom was “failing to tackle these sites and failing in its obligations to protect women and girls”.

Intimate images are classed as those that show nudity or a sexual act, a person’s genitals, buttocks or breasts covered only with underwear, or a person going to the toilet.

In February, Keir Starmer said that deepfake nudes and “revenge porn” must be removed from the internet within 48 hours or technology firms risk being blocked in the UK, calling it a “national emergency” that the government must confront.

Ofcom is now urging sites to use “hash-matching” technology, which detects violating intimate images shared without consent and automatically stops them being circulated further.

The guidelines aim to prevent what the technology secretary, Liz Kendall, on Monday called a “never-ending nightmare” for victims of intimate image abuse.

A particular concern for campaigners is niche online forums where people trade intimate images taken without consent. These forums often group women by location, for example village or university hall of residence, creating serious safety risks.

The code is expected to come into force in the autumn, subject to parliamentary process.

Ofcom’s move has been welcomed by campaigners, but they said the regulator should go further and mandate the use of technology to block the posting of such damaging content.

Kendall said: “Existing technology must now be used to put a permanent stop to intimate image abuse, by recognising illegal images and blocking them before they can cause further harm. No more excuses.”