Nearly 6 million people in the UK are to be told they have paid the wrong amount of tax, with some facing bills demanding up to £5,000 in extra payments.

Around 1.4 million people will be told they owe an average of £1,400 because of errors in HM Revenue and Customs' calculations of the pay as you earn (PAYE) tax system over the past two years.

The errors were identified by a new computer system that found widespread underpayments by employers through the PAYE system, which total about £2bn.

Employees who moved jobs or accepted company cars or cash benefits from their employer were the most likely to be caught by the new system.

But 4.3 million people are set to receive a rebate because they have paid too much. With a total overpayment of £1.8bn, each could receive an average rebate of £418.

The first 45,000 letters from HM Revenue and Customs (HMRC) are expected to arrive on doormats on Tuesday.

Around 30,000 letters will alert taxpayers that they are due a rebate and 15,000 will inform them that they have underpaid and will have their tax code altered next year to retrieve the money.

With an average additional payment of £1,428 being demanded, those affected by underpayments could be more than £100 a month worse off next year while the cash is recouped.

It is believed that in some cases individuals may have both underpaid and overpaid, and the amounts could cancel one another out.

In some cases, HMRC will consider writing off demands where taxpayers can demonstrate that they provided all the information necessary to calculate their tax correctly.

The problems arise because at the end of each year HMRC checks that the amounts deducted in tax and national insurance by employers using the PAYE system mach up with the information held on their records.

The process of checking contributions was done manually on a case-by-case basis until last June when a new computerised system was introduced, which HMRC says should help reduce mistakes in the future. It aims to reconcile information held on different systems within HM Revenue and Customs.

A HMRC spokesman said: "The vast majority of the 40 million people who pay through PAYE deductions are correctly taxed, but because circumstances change during the year there will always be a minority who have paid either too much or too little."

He said taxpayers could dispute extra tax charges by claiming on a ESC19 form that they had supplied information in good faith and retrospective bills should be dropped.

Anita Monteith, of the Institute of Chartered Accountants in England and Wales, said some people would not have to make the repayments if HMRC made the error while calculating the tax codes manually.

She said: "HMRC can agree to give up collecting an underpayment if they had the right information to calculate tax deductions and did not use it when they should have done.

"However, it would depend on what has caused the underpayment."

Monteith said anyone who receives a letter should first check that the HMRC's new calculation matches the information on the P60 for that year.

"If you disagree with what they are asking for then call or write to HMRC. However, you might find that the phone lines are jammed next week.

"People cannot refuse to pay the money because it is legally due."