A coding error has led Optus to announce it will pay back millions of dollars to thousands of customers it overcharged.

It appears to have been a simple error of copy-and-paste from a programmer back in 2011, but the duplicated code meant 235,000 post-paid mobile and small business customers were charged and being given more than they asked for.

Optus has confirmed it will be giving back around $8.8 million to customers affected by the oversight.

“It took us a while to work it out. [Customers] would call up and we would compensate that individual,” a spokesperson said.

“The calls were starting to increase, and we looked at the IT behind it and realised there was a systemic issue.”

The duplicated fees are not the greatest gouge of all time, costing an average of $37.40 over two years per customer.

The refunds will even be issued with interest included.

Optus has informed relevant regulatory and competition bodies the Australian Competition and Consumer Commission (ACCC), the Australian Communications and Media Authority (ACMA) and the Telecommunications Industry Ombudsman (TIO) of the issue.