Australian Business Number (ABN) Validation

The Australian Business Number (ABN) is a unique 11-digit identifier issued by the Australian Tax Office for all business dealings with the tax office and for dealings with other government departments and agencies. An ABN is issued to all business types including company, sole trader and partnership registrations.

You can lookup company details by ABN, ACN or name here: http://www.abr.business.gov.au/

An ABN consists of 11 digits, conventionally formatted as 'nn nnn nnn nnn'. The verification process is as follows:

  1. Subtract 1 from the first (left) digit to give a new eleven digit number.
  2. Multiply each of the digits in this new number by its weighting factor.
  3. Sum the resulting 11 products.
  4. Divide the total by 89, noting the remainder.
  5. If the remainder is zero the number is valid.

The weighting table is as follows:

PositionWeightPositionWeight
110711
21813
33915
451017
571119
69

Reference

The Australian Tax Office reference for validating Australian Business Numbers moves from time to time. The last sighting was here: http://www.ato.gov.au/Business/Australian-business-number/In-detail/Introduction/Format-of-the-ABN/

Try It!

Sample Code

//   ValidateABN
//     Checks ABN for validity using the published 
//     ABN checksum algorithm.
//
//     Returns: true if the ABN is valid, false otherwise.
//      Source: http://www.clearwater.com.au/code
//      Author: Guy Carpenter
//     License: The author claims no rights to this code.  
//              Use it as you wish.

function ValidateABN($abn)
{
    $weights = array(10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19);

    // strip anything other than digits
    $abn = preg_replace("/[^\d]/","",$abn);

    // check length is 11 digits
    if (strlen($abn)==11) {
        // apply ato check method 
        $sum = 0;
        foreach ($weights as $position=>$weight) {
            $digit = $abn[$position] - ($position ? 0 : 1);
            $sum += $weight * $digit;
        }
        return ($sum % 89)==0;
    } 
    return false;
}

You might also be interested in this version by Paul Ferrett which includes ACN validation, based on the ACN validation algorithm. published by ASIC. Nice.


comments powered by Disqus