Singapore Vehicle License Plate Check Character Calculator & Validator

Here’s something extremely obscure!

A few years ago I spent a lot of time in Singapore and, as always, wanted to understand their system of vehicle registration places (license plates).

The basic system is easy to understand.Wikipedia has some basic documentation here.

Here’s an illustration from Wikipedia of a current private vehicle plate design (front and rear).

It’s British heritage is obvious but the Singapore Government made an enhancement that’s unusual. Almost every license plate (apart from military and diplomatic plates) has an alphabetic character at the end. It’s not a “year letter” like the old British system but a “check character”.

The check character is calculated from the values of the other characters in the plate and serves as a validator. If you make a mistake recording the plate the check character will be wrong.

As far as I know the Singapore Government does not document the check character generation algorithm for the public. I had a big database of Singapore license plates I’d observed and back in 2002 I tried to reverse-engineer the algorithm.

My mathematics isn’t the best so I got some help from somebody on the Internet. He quickly helped me understand the system and I wrote some Microsoft Visual Basic code to calculate check characters and to validate them.

I published a Microsoft Excel spreadsheet with the code on my web site, but I closed it down in 2007 as an economy measure. When I discovered Scribd I decided to re-publish it as a service to anyone else who’s interested in the subject.

In the spirit of open-source I placed the code in the public domain under a GNU General Public License. I don’t know how many people are interested in this obscure subject but if you are, you’re welcome to the code.

After the break is an embedded form of the spreadsheet from Scribd. Don’t worry about the “VALUE” errors in the preview – Scribd rendered the preview incorrectly.

I am not a great Visual Basic coder so I’m sure many people can improve the code. I’ve tested it on hundreds of Singapore plates of all types including the new “SMB” bus plates and it works. But of course that isn’t a formal proof of correctness. As the license says – no warranty!

When I wrote the code I put lists of validated registration plates for the various classes of Singapore buses on the Singapore Buses Discussion Board on Yahoo Groups. They’re still there in the “Files” section over seven years later.

View this document on Scribd

Advertisements

Tags: , , , , , ,

5 Responses to “Singapore Vehicle License Plate Check Character Calculator & Validator”

  1. BKKPhotographer Says:

    I just noticed, the check character in the example above is WRONG! It should be G.

    In the Wikipedia article all the example plate pictures have incorrect check characters but the photos of plates on vehicles validate correctly using my Visual Basic code.

  2. BKKPhotographer Says:

    You can view the plates that Singapore is currently issuing to Cars, Light Goods Vehicles and Motorcycles at http://app.lta.gov.sg/motoring_vo_bid.asp

    These lists provide a good test case for the code for a limited number of vehicle types.

  3. Michael Willems Says:

    And it works? So what is the algorithm, basically?

    • BKKPhotographer Says:

      Yes!

      In brief …

      There are 19 possible values for the check character: ABCDEGHJKLMPRSTUXYZ

      If we represent a registration as l1 l2 l3 d1 d2 d3 d4 c with leading zeroes for the digits then the remainder

      (l2 * 9 + l3 * 4 + d1 * 5 + d2 * 4 + d3 * 3 + d1 * 2) / 19 is the index into the array of check characters.

      The trick was finding the values for those weights (9, 4, 5, 4, 3, 2) in the calculation.

  4. BKKPhotographer Says:

    I confirmed that this is a very obscure interest. In a month on Scribd 165 people have read the entry for the spreadsheet but nobody has downloaded it. The one download in the record is me testing that the spreadsheet downloads correctly. Oh well.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: