There are a couple of ways to check that a VAT registration number is valid:
Calling the HMRC VAT helpline.
HMRC has a complete database of VAT-registered businesses. If you're in doubt about a VAT number, you can call their helpline on 0300 200 3700.
Check the GOV.UK website.
You can use the service if you have a VAT number for the business you are checking. The service will check if the VAT number is valid and confirm the company name and address of the business the number is registered to.
www.gov.uk/check-uk-vat-number
If you are a UK VAT-registered business, you can also use this service to prove when you checked a UK VAT number. You will need your own VAT number to do this.
Checking the VIES website.
You can use the European Union's VAT Information Exchange System (VIES) to check the validity of both UK VAT numbers and VAT numbers from the wider EU. You can check if a supplier's VAT number is valid by entering the registration numbers and relevant country codes into the fields provided.
If VIES shows the supplier's VAT registration as invalid, you should contact them to get the correct VAT number as soon as possible.
Use Creditsafe to Verify a company's VAT number.
If you run a search on your supplier using Creditsafe, you can find verified VAT numbers that belong to that company.
Check and Verify a company VAT number using Creditsafe.