Australian Business Number (ABN) Validation
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:
Subtract 1 from the first (left) digit to give a new eleven digit number. Multiply each of the digits in this new number by its weighting factor. Sum the resulting 11 products. Divide the total by 89, noting the remainder. If the remainder is zero the number is valid. The weighting table is as follows:
Position | Weight | Position | Weight |
---|---|---|---|
1 | 10 | 7 | 11 |
2 | 1 | 8 | 13 |
3 | 3 | 9 | 15 |
4 | 5 | 10 | 17 |
5 | 7 | 11 | 19 |
6 | 9 |
Sample Code - PHP
// 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;
}
Reference
The Australian Tax Office reference for validating Australian Business Numbers moves from time to time. The last sighting was here: https://abr.business.gov.au/Help/AbnFormat
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.