Side-effects can include heart problems, blurred vision and diarrhoea, and some contain banned ingredients.
The Medicines and Healthcare Products Regulatory Agency (MHRA) said people should go to their GP for advice first.
A survey of 1,800 slimmers found one in three had bought pills online, with two-thirds experiencing side-effects.
Most of those questioned by the MHRA and Slimming World had bought online because they had wanted to lose weight quickly. About 40% said they had not wanted to speak to a GP or pharmacist.
Sarah-Jayne Walker, 30, saw diet pills as "a quick fix", but they gave her palpitations and made her feel faint.
She bought the pills online and took them for four months, before realising she had no idea what was in them.
"The pills came in a little white bottle with no leaflet and no instructions," she says.
"Looking back, I think, 'What was I doing?'
"I was in a desperate place - my weight had fluctuated for years - and I fell for the promises online."
Sarah-Jayne suffered from light-headedness, sickness and irritable bowel syndrome.
"I knew the pills were affecting my body and I had become dependent on them," she says.
The MHRA said people should take medicines only after a consultation with their GP.
The agency's #FakeMeds campaign warns buying from websites also increases the risk of being ripped off or having your identity stolen.
Top tips to avoid fake medicines online
Before buying, check if the seller is licensed to sell medicines online, through this checking system
"Herbal" or "all-natural" products can still contain chemical ingredients that may have side-effects
Contact the MHRA if you have experienced side-effects from a suspected fake product
Don't self-diagnose - a doctor can work out the right treatment for you
MHRA senior policy manager Lynda Scammell said: "Quick fixes for losing weight may have serious health consequences in the short or long term, including organ failure and death.
"It's essential you know what you're buying online and what the risks are.
"If you don't, your weight could end up being the least of your worries."
In 2016, more than 4.6 million fake medical products were seized by the MHRA. The agency also closed down more than 5,000 websites selling medicines illegally.
In the UK, there are no medicines licensed for slimming, although some are licensed for treating obesity.
The MHRA said many of the slimming pills seized contained ingredients that could put dieters in danger - such as sibutramine, which has been linked to an increased risk of heart attacks and stroke.
The agency also seizes other fake products regularly, such as dental equipment, sexually transmitted infection, HIV and pregnancy tests and erectile dysfunction medications.