Virgin Media must pay out £7million while EE was landed with a £6.3 million fine after the regulator found both to have broken customer protection rules.
It was deemed each failed to make clear the charges customers would have to pay if they ended their contract early and charged "excessive" fees to leave.
Each has agreed to change their terms following this, though Virgin Media will appeal what it called a “disproportionate” fine.
Over a six-year-period, between 2012 and 2018, EE overcharged around 400,000 customers taking a total of approximately £4.3million
While Virgin Media, between 2016 and 2017, did the same with 82,000 of its subscribers, wrongly taking just under £2.8million.
Gaucho Rasmussen, Ofcom’s director of investigations and enforcement, said: “EE and Virgin Media broke our rules by overcharging people who ended their contracts early. Those people were left out of pocket, and the charges amounted to millions of pounds.
“That is unacceptable. These fines send a clear message to all phone and broadband firms that they must play by the rules, in the interests of their customers.”
Phone and broadband companies can charge customers who decide to leave their contracts early.
However, under Ofcom rules costs must be made clear to customers and not make switching to another provider too costly.
Tom Mockridge, chief executive of Virgin Media, said: "A small percentage of customers were charged an incorrect amount when they ended one or more of their services early and for that we are very sorry.
"As soon as we became aware of the mistake we apologised and took swift action to put it right by paying refunds, with interest, to everyone affected.
“This unreasonable decision and excessive fine does not reflect the swift actions we took, the strong evidence we have presented, or our consistent, open and transparent cooperation with the regulator."
The company said 1.5 per cent of its 5.5million cable customers were affected.
A spokesperson for EE said it accepted the findings and has refunded those affected.
“We accept Ofcom’s findings and recognise that we have made a mistake. We apologise to customers with discounted tariffs who paid more than they should have when cancelling their contracts early,” they said.
They also wished to clarify that “incorrect charging only affected customers with recurring monthly discounts”.
Ofcom's investigation found that BT owned company EE did not clearly set out the exit fees that would be charged to customers on discount contracts, so when 400,000 decided to leave and they were over-billed.